Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Encoding problems
#1
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
Reply
#2
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.
Reply
#3
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.
Reply
#4
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.
Reply
#5
(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
Reply
#6
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.
Reply
#7
Is it happening on a specific row of data? What encoding is the data base using for storage?
Reply
#8
(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?
Reply
#9
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.
Reply
#10
(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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)