Posts: 144
Threads: 33
Joined: Jun 2018
Reputation:
3
Location: USA
I need help with the following error: No mapping for the Unicode character exists in the target multi-byte code page
I am using iw14.2.7
I have a iwdbgrid that total throws the error above and kicks me out of the iw program. Any ideas on how to solve this?
Below is the call stack.
(00057ABC){WebDesk.exe } [00458ABC] System.SysUtils.TEncoding.GetString + $F0
(000E447A){WebDesk.exe } [004E547A] System.Classes.TStringStream.GetDataString + $16
(00784A7C){WebDesk.exe } [00B85A7C] IWDBGrids.TIWDBGrid.RefreshData (Line 572, "IWDBGrids.pas" + 150) + $6
(00783A18){WebDesk.exe } [00B84A18] IWDBGrids.TIWDBGrid.RenderCells (Line 295, "IWDBGrids.pas" + 30) + $8
(00780617){WebDesk.exe } [00B81617] IWCompGrids.TIWCustomGrid.RenderInnerHTML (Line 783, "IWCompGrids.pas" + 45) + $9
(00780028){WebDesk.exe } [00B81028] IWCompGrids.TIWCustomGrid.RenderHTML (Line 711, "IWCompGrids.pas" + 4) + $7
(0035B98A){WebDesk.exe } [0075C98A] IWBaseHTMLControl.TIWBaseHTMLControl.RenderMarkupLanguageTag (Line 547, "IWBaseHTMLControl.pas" + 1) + $4
(0033BCAB){WebDesk.exe } [0073CCAB] IWContainer.TIWContainer.RenderComponents (Line 484, "IWContainer.pas" + 58) + $31
(00350A0C){WebDesk.exe } [00751A0C] IWRegion.TIWCustomRegion.RenderComponents (Line 460, "IWRegion.pas" + 2) + $F
(0033BE92){WebDesk.exe } [0073CE92] IWContainer.TIWContainer.RenderComponents (Line 505, "IWContainer.pas" + 79) + $A
(00350A0C){WebDesk.exe } [00751A0C] IWRegion.TIWCustomRegion.RenderComponents (Line 460, "IWRegion.pas" + 2) + $F
(0033BE92){WebDesk.exe } [0073CE92] IWContainer.TIWContainer.RenderComponents (Line 505, "IWContainer.pas" + 79) + $A
(00350A0C){WebDesk.exe } [00751A0C] IWRegion.TIWCustomRegion.RenderComponents (Line 460, "IWRegion.pas" + 2) + $F
(0033BE92){WebDesk.exe } [0073CE92] IWContainer.TIWContainer.RenderComponents (Line 505, "IWContainer.pas" + 79) + $A
(0036A975){WebDesk.exe } [0076B975] IWForm.TIWForm.RenderComponents (Line 1425, "IWForm.pas" + 1) + $4
(00366C0D){WebDesk.exe } [00767C0D] IWForm.TIWForm.DoGenerateForm (Line 631, "IWForm.pas" + 104) + $18
Posts: 651
Threads: 2
Joined: Mar 2018
Reputation:
35
Location: California, USA
(06-12-2018, 05:21 PM)joelcc Wrote: I need help with the following error: No mapping for the Unicode character exists in the target multi-byte code page
I do not use IntraWeb, but it is clear from the stack trace that the error is coming from the TStringStream.DataString property getter. Chances are, the TStringStream was most likely constructed with a SysUtils.TEncoding object that does not match the real encoding of the bytes that are in the stream. For instance, if the stream were constructed with TEncoding.UTF8, but the bytes are not encoded in UTF-8. TStringStream does not allow its TEncoding to be changed after construction, so the creator has to get the encoding correct up front, and that can sometimes be difficult to do, especially if the encoding is not known until after the stream is populated. That is why I rarely ever use TStringStream in Delphi 2009+.
Posts: 144
Threads: 33
Joined: Jun 2018
Reputation:
3
Location: USA
So how do I set the Encoding to be UTF-8 in intraweb?
Posts: 651
Threads: 2
Joined: Mar 2018
Reputation:
35
Location: California, USA
(06-12-2018, 05:51 PM)joelcc Wrote: So how do I set the Encoding to be UTF-8 in intraweb?
I didn't say that WAS your issue, just that it was an EXAMPLE of something that COULD cause the error. I suggest you look at IntraWeb's source code to see exactly where TIWDBGrid.RefreshData() is trying to access a TStringStream, and then follow the creation of that stream to find out why it is being created with an Encoding that is different than its actual payload.
Posts: 288
Threads: 0
Joined: Mar 2018
Reputation:
29
Location: Franca-São Paulo-Brasil
Hi Joel, you use template?, if yes look at comments of your html like <!-- comment's -->, remove any apostrophe from HTML.
Posts: 144
Threads: 33
Joined: Jun 2018
Reputation:
3
Location: USA
Thanks for the tip. We use templates however I checked and there are no comments with apostrophe.
Posts: 2,261
Threads: 196
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
(06-12-2018, 05:36 PM)rlebeau Wrote: (06-12-2018, 05:21 PM)joelcc Wrote: I need help with the following error: No mapping for the Unicode character exists in the target multi-byte code page
I do not use IntraWeb, but it is clear from the stack trace that the error is coming from the TStringStream.DataString property getter. Chances are, the TStringStream was most likely constructed with a SysUtils.TEncoding object that does not match the real encoding of the bytes that are in the stream. For instance, if the stream were constructed with TEncoding.UTF8, but the bytes are not encoded in UTF-8. TStringStream does not allow its TEncoding to be changed after construction, so the creator has to get the encoding correct up front, and that can sometimes be difficult to do, especially if the encoding is not known until after the stream is populated. That is why I rarely ever use TStringStream in Delphi 2009+.
All TStringStream instances in IntraWeb (and everything else basically that needs an encoding) is created with UTF-8 encoding because that's what is actually generated to the browser. 99% of the times I've seen this it is caused by a DB layer issue (several times relates to Firebird DBs).
Posts: 2,261
Threads: 196
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
(06-12-2018, 05:21 PM)joelcc Wrote: I need help with the following error: No mapping for the Unicode character exists in the target multi-byte code page IntraWeb uses UTF8 encoding when creating String streams, *always*. Every time I see this issue in an IW application it happens when IW interfaces with some DB layer, exactly that case here. IW is retrieving data coming from DB and trying to encode it as UTF8 but it is not possible.
What DB access framework are you using? What is the RDMBS? Are you sure that the encoding is correct?
Posts: 55
Threads: 19
Joined: Apr 2018
Reputation:
0
06-13-2018, 03:55 AM
(This post was last modified: 06-13-2018, 03:58 AM by joel.)
(06-12-2018, 11:59 PM)Alexandre Machado Wrote: (06-12-2018, 05:21 PM)joelcc Wrote: I need help with the following error: No mapping for the Unicode character exists in the target multi-byte code page IntraWeb uses UTF8 encoding when creating String streams, *always*. Every time I see this issue in an IW application it happens when IW interfaces with some DB layer, exactly that case here. IW is retrieving data coming from DB and trying to encode it as UTF8 but it is not possible.
What DB access framework are you using? What is the RDMBS? Are you sure that the encoding is correct?
This is going through a MiddleTier call to Remobjects Data Abstract which is using the Devart Unidac to an Oracle database. Unicode is turned on.
<ConnectionString>UniDAC?AuxDriver=Oracle;Server=some;Database=some;UserID=xxxxx;Password=apassword;Net=0;UseUnicode=True;</ConnectionString>
Posts: 144
Threads: 33
Joined: Jun 2018
Reputation:
3
Location: USA
(06-13-2018, 03:55 AM)joel Wrote: (06-12-2018, 11:59 PM)Alexandre Machado Wrote: (06-12-2018, 05:21 PM)joelcc Wrote: I need help with the following error: No mapping for the Unicode character exists in the target multi-byte code page IntraWeb uses UTF8 encoding when creating String streams, *always*. Every time I see this issue in an IW application it happens when IW interfaces with some DB layer, exactly that case here. IW is retrieving data coming from DB and trying to encode it as UTF8 but it is not possible.
What DB access framework are you using? What is the RDMBS? Are you sure that the encoding is correct?
This is going through a MiddleTier call to Remobjects Data Abstract which is using the Devart Unidac to an Oracle database. Unicode is turned on.
<ConnectionString>UniDAC?AuxDriver=Oracle;Server=some;Database=some;UserID=xxxxx;Password=apassword;Net=0;UseUnicode=True;</ConnectionString>
Thanks everyone. I figured out the issue.
the connection string needs to have SpecificOptions.UseUnicode=True; not UseUnicode=True for the driver to work properly.
|