Encoding problems

<< Click to Display Table of Contents >>

Navigation:  Forum >

Encoding problems

Forum link

 

Pages: 1 2

 


 

05-19-2019, 10:59 AM:

 

Hi,

 

I'm migraring on of our vcl apps to intraweb and run to exception "No mapping for the Unicode character exists in the target multi-byte code page". 

 

I understand that it something to with encoding, but how I do encode data when it comes directly from dataset trough datasource?

 

I'm using Delphi 10.3.1 and IW 15.0.21. At form I have tiwdbedits, tiwdbgrids

 

Characters are special characters like ä and ö (iso-8859-15) 

 

thanks

 

mika

 


 

05-19-2019, 05:10 PM:

 

Unicode supports all possible characters. Individual encodings do not. It sounds like you have a Unicode character that is trying to be encoded in an encoding which has no matching character.

 


 

05-20-2019, 05:17 AM:

 

Issue must rise from database component which is still based on BDE. It works on normal vcl apps but probably outputs string as ansistrings still.

 


 

05-20-2019, 01:15 PM:

 

IW itself uses Unicode and only converts out of Unicode if you specify final HTML output other than Unicode. Even for that, its best to just use Unicode. There really ins't any need to use an older encoding for output now that Unicode is supported everywhere.

 


 

05-22-2019, 09:15 AM:

 

(05-20-2019, 05:17 AM)MikaK Wrote: [ -> ]Issue must rise from database component which is still based on BDE. It works on normal vcl apps but probably outputs string as ansistrings still.

 

I'll give you one main recommendation: Get rid of BDE. BDE has been long dead. It is not intended to be used any more specially in a web application.

 

It is not that hard to replace it by other DB layer. Even ADO works much much better than BDE. 

 

If you are writing a web application don't ever use BDE

 


 

05-22-2019, 10:07 PM:

 

So I have the same error on a non BDE (I am using dbexpress) datasource.

 

If I debug through the iwdbgrids.pas at line 572 I get the error

 

                    if CurrentField.DataType in [ftBlob, ftMemo] then begin

 

                      LBlobStream := TStringStream.Create('', TEncoding.UTF8); try

 

                        (CurrentField as TBlobField).SaveToStream(LBlobStream);

 

--this is the line the causes the error.

 

                        S := LBlobStream.DataString;

 

                      finally

 

                        LBlobStream.Free;

 

                      end;

 

Any ideas on how to solve this issue?   Maybe it is a bad driver.

 

I am using Seattle and iw14.

 


 

05-23-2019, 01:50 PM:

 

Is it happening on a specific row of data? What encoding is the data base using for storage?

 


 

05-23-2019, 03:34 PM:

 

(05-23-2019, 01:50 PM)kudzu Wrote: [ -> ]Is it happening on a specific row of data? What encoding is the data base using for storage?

 

Yes.   It is only on a specific row.   (I notice when someone copies data from Microsoft Word with the an ' it will throw the error).

 

Using 

 

SELECT *

 

  FROM v$nls_parameters

 

 WHERE parameter LIKE '%CHARACTERSET';

 

I see that the Oracle Database encoding is set to WE8MSWIN1252

 

I also see see that the field that is holding the data is CLOB

 

I am using the devart Oracle dbx driver with the following settings (but that probably does not make up the difference.)

 

ClobAswideMemo := true

 

UnicodeEnvironment := true

 

UseUnicode := true

 

I can not change the Characterset on the the database but I might be able to change the CLOB to an NCLOB at the field level.

 

Do you think that would fix the issue?

 


 

05-23-2019, 03:45 PM:

 

There are so many places this could be an issue with that combination.

 

I would suggest that you try to narrow it down with a minimal test case in a simple VCL application.

 


 

05-24-2019, 01:15 PM:

 

(05-23-2019, 03:45 PM)kudzu Wrote: [ -> ]There are so many places this could be an issue with that combination.

 

I would suggest that you try to narrow it down with a minimal test case in a simple VCL application.

 

Changing the field to nclob does not help.    I have a work around until I can find a better solution.

 

Thanks for the help.