When I using xmlCfg unit i found problem with storing literals in arbitrary code page. XMLCfg perform automatic conversion with omit some chars.
I've change it to use utf8string instead of. Maybe this patch will be interesting.
Mailing lists / fpc-devel / 2010-11
[PATCH] XMLCFG AnsiStringDOMString conversion
10 messages · 6 people · –
- DDariusz Mazur 3
- FFelipe Monteiro de Carvalho 2
- SSergei Gorelkin 2
- MMarco van de Voort 1
- SSven Barth 1
- UUnknown author 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
пишет:
Show quoted text 6 lines
Such patch will make all existing config files with non-ascii data unreadable. In the meantime, I wrote the xmlconf unit exactly to avoid this problem. So if you need Unicode configs, you should switch to xmlconf. Calls to Utf8Encode/Decode will be still necessary because xmlconf.TXMLConfig has WideString parameters, but it won't strip any non-ascii data.
Regards,
Sergei
W dniu 2010-11-03 23:50, Sergei Gorelkin pisze:
Show quoted text 9 lines
Today also. All nonasci charracter are translate to '?' during reading (implicit conversion widestring>ansistring).
On other side in XML should not be not asci char
Show quoted text 5 lines
XMLCfg is enought to me,
but then you should add note that this unit is depreciated
In our previous episode, Dariusz Mazur said:
Show quoted text 8 lines
This is not the same, current all chars in the current codepage (also above
127) will be fine. Only the ones NOT in the current codepage will turn up as '?' If you change to UTF-8, this will change.
W dniu 2010-11-04 17:44, Marco van de Voort pisze:
Show quoted text 11 lines
then I have a question : how to change current code page
W dniu 2010-11-03 23:50, Sergei Gorelkin pisze: Today also. All nonasci charracter are…
Dariusz Mazur wroteToday also. All nonasci charracter are translate to '?' during reading (implicit conversion widestring>ansistring). On other side in XML should not be not asci char
I don't know if you meant it that way (if not, you are free to ignore what I write here ^^), but a XML document may contain (nearly) any Unicode character even in tag and attribute names: http://en.wikipedia.org/wiki/XML#International_use
Regards,
Sven
W dniu 2010-11-04 17:44, Marco van de Voort pisze: then I have a question : how to change…
Dariusz Mazur wrotethen I have a question : how to change current code page
You shouldn't. If you want to convert between code pages, then the Lazarus conversion code should be copied to FPC:
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/lcl/lconvencoding.pas?view=markup&root=lazarus
W dniu 2010-11-05 11:52, Felipe Monteiro de Carvalho pisze:
On Thu, Nov 4, 2010 at 7:51 PM, Dariusz Mazur wrote: > then I have a question : how to change current code page
I say wrong: how to change code page used to implicit conversion ansistring<-> wide string
You shouldn't. If you want to convert between code pages, then the
I don't want, but there is implicit conversion ansi<->wide, inside xmlcfg, depend on current code page. I assume, that this code page depend from OS, but this is bad for me, I need to control how chars are translated, because program can be use on different machines.
Dariusz Mazur wroteI say wrong: how to change code page used to implicit conversion ansistring<-> wide string
Use the appropriate conversion routine instead, and avoid implicit conversions for they are not reliable.
Felipe Monteiro de Carvalho пишет:
Show quoted text 7 lines
It is impossible to avoid implicit conversions with xmlcfg, because they occur within unit implementation.
I should have marked xmlcfg as deprecated a long time ago. Anyway, done in rev.16307.
Regards,
Sergei
