Czech Win (EASTEUROPE_CHARSET) and Danish characters FAIL

  • Hi,

    I have really big probelm. We are using WPTools on czech Windows (it uses easteurope_charset). One of our customers need to enter danish text with special characters. But in WPTools I always see wrong characters.

    For example instead of UNICODE (UTF-8) char $00E6 (æ) I got in WPTools always char E6 from EASTERNEUROPE_CHARSET (ć). How can I force WPTools to accept the unicode symbol. I am using method WPRichText.InsertString(Chr($00E6)). What is the correct way to handle this? If I use codes bigger then 256, I got always correct UTF-8 symbols in text.

    Thanks for any help.

    PS: I am using WPTools 6 in XE2.

  • It doesn't work, because this is code in WPTools, where you can see that CodePage has no meaning in InputString. And InputString directly calls InputStringW. :-(

    I am using Arial Unicode MS font. The problem is, that WPTools always uses EASTEUROPE_CHARSET for characters between 127 and 256. If I run CharMap from Windows, I can see in this font difference when selecting Unicode CodePage - which I need and Eastern Europe CodePage - this characters I got for needed chars. I need to say that in all other VCL text editting controls are these symbols correctly visible.

  • I also tried to call WPRiichText.Memo.InsertString(Chr($00E6), True, 1252) but it still doesn't work. It looks like the font has always set wrong CharSet, even if I change it by CurrAttr.Charset := ANSI_CHARSET; When I execute this code, I still see EASTEUROPE_CHARSET in font properties dialog. :-(

  • More information for the problem.

    I am using WPRichText.FontSelect method. You have a bug in this method, because you are not correctly assigning selected CharSet to CurrAttr. I updated your source and now I am able to correctly set charset in the font dialog. I then setup ANSI_CHARSET to Arial Unicode MS. But this doesn't help with my problem. I am still not able to enter danish characters also by keyboard in combination with czech windows. I have installed danish keyboard and changed locale in system options, but WPTools still uses the EASTEUROPE_CHARSET to display the characters between 127 and 255.

  • For testing just try to copy/paste with keyboard following UNICODE text into any of your demo apps. I never got correct result in WPTools editor.

    Zitat

    Test ÆØÅæøå 234564ščřžýáíí

    If I run for example you numberings demo and paste this text into WPTools you will see wrong text. If I enter the same text into the memo in the same app, text is inserted correctly.

  • Hi,

    I am sorry, but I have still problems on Windows 7 running at code page 1250.

    I just created complete new project. Clean application with two TWPRichText component on the form. I checked that $DEFINE UPDATECODEPAGE is ON. In one editor I set wpDisableAutoCharsetSelection to True. When I copy text directly from this forum and paste it in both editors I always get following text pasted. And I can see no way how to change this...

    Code
    Test ĆŘĹćřĺ 234564ščřžýáíí

    I am using WPTools 6.29.1.

  • If you look at the HTML code generated for my example, the symbol Ø (in 1252 is code 248) converted to ř (in 1252 is this with code 345). The reason is that in 1250 is at position 248 symbol ř which is in UNICODE with code 345. So there goes the conversion. But how to switch off these conversion? The options didn't wotk.

    • Offizieller Beitrag

    When you paste text the Reader is called and there the current code page is used. If it would be otherwise, everybody else would complain.

    This happens in PasteFromClipboard:

    load := FMemo.LoadFromStream(Stream,
    not(wpcoDoNotUseInsertMode in FClipboardOptions), '', FALSE, Reader,
    InternBeforePasteEvent);

    There it would be possible to specify the current Codepage if that is different

    'AUTO;Codepage=' + IntToStr(Memo._CodePage)

  • Hi,

    You mean that I need to change the WPTools source? But what should I do, if I need to just enter the text with keyboard. Not just with pasting by clipboard? Is it possible to somehow use CurrAttr.CharSet value to select the right codepage when inserting or writing text?

    And how should I use InputString method to correctly insert the right symbol?

  • Hm, I am sorry, but it didn't work. I created clean sample application. In the application I created one WPRichText component. In OnCreate for the form I write:

    Code
    procedure TForm1.FormCreate(Sender: TObject);begin  WPRichText1.Memo._CodePage := 1250;  WPRichText1.CurrAttr.CharSet := ANSI_CHARSET;end;


    But when I paste the text, it is always wrong. I traced values in PasteFromClipboard, where I changed source as suggested.

    Code
    .....
        CodeSite.Send('CodePage', Memo._CodePage);
        load := FMemo.LoadFromStream(Stream,
          not (wpcoDoNotUseInsertMode in FClipboardOptions)
          , 'AUTO;Codepage=' + IntToStr(Memo._CodePage), false, Reader, InternBeforePasteEvent);
       ......

    I always received correct CodePage 1252, but the text is loaded and displayed with wrong symbols. :(

  • Hi,

    any news about this? We have really big problems because of this WPTools behavior. Some of our customers in Czech republic (with czech windows) are creating content for their needs. But they need to create content for danish or deutsh users. Currently they cann't use our product and I have no easy way how to solve it. :-(

    PS: All other VCL controls works correctly. I don't need to change anything to be able to write correct unicode symbols in these controls. So I see it as a bug in WPTools.

  • Hi,

    can you send me the compiled demo from your computer and I will test it here? I tried to change Windows locale here too but it has no effect on the editor. But when I use original english version of Windows, everything works as expected. I can enter czech and danish characters in the same editor without problem.

    Send me, please, compiled exe to email slipek.at.dosli.cz. Thanks.

  • Hi,

    thanks for the demo. In the sended demo I am able to correctly enter danish characters. So there is some difference in our Delphi setup, because if I compile the app on our system, I am unable to enter correct symbols. I redownloaded latest WP6 source and look at the differences in the *.pas files and I can see no difference in my current source and your default source. Only few differences in INC files (I am using also wPDF). Is there any option I should look for?

  • Hi,

    thanks for the info, but I need to compile my application in RAD Studio XE2. Please, can you send me compiled demo from XE2 with WPTools to test it here? Just plain editor, where I can paste or write text. There should be some problem with unicode implementation in WPTools. Thanks.