Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Unicode Bug in IntraWeb 14.0.6



Permlink Replies: 1 - Last Post: Jul 19, 2016 3:52 AM Last Post By: Alexandre Machado
Tim Lichtenberg

Posts: 3
Registered: 8/20/01
Unicode Bug in IntraWeb 14.0.6
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 19, 2016 12:44 AM
When using a database containing Unicode characters (Japanese in my case), and linking the table to a TIWDBGrid, I get the following error:

Error: No mapping for the Unicode character exists in the target multi-byte code page

[Call Stack]
System.Classes.TStringStream.GetDataString
:004B7AA2 System::Classes::TStringStream::GetDataString(Self=:032A0488)
:007e8da5 TIWDBGrid.RenderCells + $199
:007e6868 TIWCustomGrid.RenderInnerHTML + $2FC
:007e625d TIWCustomGrid.RenderHTML + $5D
:0069db95 TIWBaseHTMLControl.RenderMarkupLanguageTag + $D
:006a8a0f TIWForm.RenderComponents + $F
:006c6086 TIWAppForm.DoGenerateForm + $3E
:006c9e65 TIWBaseForm.GenerateForm + $39
:006d3237 TIWApplication.GenerateActiveForm + $107
:006d2dd9 TIWApplication.ProcessForm + $181


The problem seems to be that he wants to convert the HTML text with Unicode characters into ANSI (Codepage '1252 (ANSI - Lateinisch I) with TStringStream.GetDataString() which in turn calls TEncoding.GetString().
Even though the webpage charset is set to "utf-8".

I could fix it (if I had the source code) by chaining the constructor of TStringStream from
StringStream := TStringStream.Create();

to
StringStream := TStringStream.Create('', TEncoding.UTF8);


My system encoding is set to ANSI.

Does anyone have a solution for this?
Alexandre Machado

Posts: 1,754
Registered: 8/10/13
Re: Unicode Bug in IntraWeb 14.0.6
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 19, 2016 3:51 AM   in response to: Tim Lichtenberg in response to: Tim Lichtenberg
LBlobStream := TStringStream.Create('', TEncoding.UTF8);


This is how the TStringStream instance is created in IWDBGrids.pas. So, your fix is already there.

99.9% of the times I saw this same issue when using DB aware controls, the cause was the database itself. In those cases, the user is linking an Unicode-capable control with a underlying database field which cannot handle unicode, e.g. the field only supports ANSI.
Are you sure that this is not your case?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02