Atozed Forums
Encoding problems - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Encoding problems (/thread-1080.html)

Pages: 1 2


Encoding problems - MikaK - 05-19-2019

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


RE: Encoding prorblems - kudzu - 05-19-2019

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.


RE: Encoding problems - MikaK - 05-20-2019

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.


RE: Encoding problems - kudzu - 05-20-2019

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.


RE: Encoding problems - Alexandre Machado - 05-22-2019

(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


RE: Encoding problems - joelcc - 05-22-2019

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.


RE: Encoding problems - kudzu - 05-23-2019

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


RE: Encoding problems - joelcc - 05-23-2019

(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?


RE: Encoding problems - kudzu - 05-23-2019

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.


RE: Encoding problems - joelcc - 05-24-2019

(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.