Beiträge von ITEC

    When we use WPTools to produce HTML using the format "HTML-writespan" on Delphi 7 and WPTools V5.51. However, the colour of bullet points is discarded by the conversion and they will always be converted to black. They appear in the correct colour in the WPTools memo and HTML does support coloured bullet points. Is there a fix for this?

    The problem is that WPTools, has a bug where when the system locale is set to Japanese it does not encode CJK text with hex codes when saving to RTF. Presumably WPTools is comparing the current system locale to GetACP or CP_ACP under the assumption that this refers to 1252 or something along those lines.

    But, to be clear, the problem is that WPTools produces corrupt RTF files when those files contain CJK text and are on a Japanese (and presumably others) system locale.

    As this is a bug, an idea on when it will be fixed would be great!

    OK, it turns out that the reason it wasn't encoding the text is because my system locale (Language for non-Unicode programs) was set to Japanese (Japan). When I changed this back to English (United Kingdom) and rebooted it did start encoding the text correctly. This is not the correct behaviour, I would argue; the text should always be encoded regardless of the system locale.

    The RTF actually does look OK in the WPTools MultiDemo and in Wordpad (in contradiction to what I said before) but in Word (2007 & 2010 at least) it does not appear correctly. If I open this WPT file in the multi demo and then save it as an RTF it does the same thing and saves it without encoding.

    Well, that didn't help, for some reason WPRichEdit is not encoding the text, see the example below (original file). Notice that the Japanese text is not encoded and while it looks OK when looking at the RTF in notepad, it shows as mojibake in wordpad etc

    This is probably us misusing the component, but when we merge national text (Japanese) into a WPRichEdit and then save the memo to an RTF file, the memo does not encode the CP932 text in the normal RTF way, using escape codes and hex. Is there a specific requirement for this to work?

    OK, I think I've made a bit progress, InsertWideString() appears to never handle the painting correctly, regardless of the language, as a workaround I have tried modifying WMIMEEndComposition()

    Code
    procedure TWPCustomRtfEdit.WMIMEEndComposition(var Message: TMessage);
    begin
      inherited;
    
    
      if Assigned(FMemo._EditBox) then
        FMemo._EditBox.Invalidate();
    end;

    This seems to solve problems inputting Japanese text, but I suspect it's not the preferred solution.

    There are two Japanese issues users are experiencing, the first is that if you type text in full size katakana and then try to insert a space, nothing happens until the text is repainted, i.e. you select the text where you expect the space to appear. All the spaces you typed will then appear.

    Secondly, and I don't know if there is anything that can be done about this, if you copy Japanese text from a WPRichText memo and paste it into word, the encoding is not brought over and you get garbage mojibake. However, if you do a Paste Special in Word and choose "Unformatted Text" or "Unformatted Unicode Text" it does come over OK.

    There is a third issue that I haven't actually been able to repeat yet (probably because I don't know how to type Japanese) but one that someone may recognise is that the Japanese users showed typing Japanese text on a line. The line began with katakana and ended with hiragana and some characters were invisible until the user hit Enter, there was a space where they were expected.

    These problems also occur on the MultiDemo exe, which I think means it affects WPTools 6 as well. This is on Delphi 7 and WPTools 5.51.

    From what I can tell, historically, Japanese was not supported because of specific line wrappings. However I am trying to enter Japanese text into WPRichText controls from WPTools 5. I can actually enter the text OK, but need to press the delete key approx 15 times before the text begins to delete.

    Is there any way around this, or can this be fixed?

    This is on Delphi 7 with WPTools 5.40.