From: John L. <jla...@gm...> - 2014-02-19 05:33:58
|
On Tue, Feb 18, 2014 at 2:12 PM, Paul K <pau...@ya...> wrote: ... > What I am trying to do is to load a file into wxSTC (Scintilla > component). I know that Scintilla can deal with invalid UTF-8 > characters as SciTE displays them as nice inverted rounded boxes with > hex codes inside, but I can't get the same effect with wxSTC. If I try > to load UTF-8 file with characters in, for example, 1252 encoding, the > content fails to load into wxSTC (it shows as empty). > > I'm no expert in UTF8, but isn't it possible that a malformed UTF8 sequence makes the rest of the file unusable in the sense that you can't really be sure how many bytes the 'bad' sequence is so you could be off by a few bytes for the rest of the file? What's interesting is that the content is loaded from a file just > fine, so it seems like at least that part is handled correctly, but > the text is not loaded into wxSTC until I find and fix invalid UTF-8 > characters (I use SetText method, but I've tried others with the same > result). I thought that using From8BitData() may help me to pass all > those characters intact to Scintilla, which will be able to display > them, but I can't test as From8BitData() is not exposed in wxlua. > > From8BitData() is now in SVN trunk. I'm not sure that it will help as it uses the wxConvISO8859_1 converter, but it is different than the normal wxConvUTF8 converted used normally. Regards, John |