[fpc-pascal] DOM and UTF-8 widestring conversion

Seth Grover sethdgrover at gmail.com
Mon Nov 21 18:14:24 CET 2016

After playing around some more with my example, I was able to get it to
work in 2.6.4 (without using the cwstring unit) by using the lazutf8
unit's UTF8ToUTF16
routine on the SetAttribute and UTF16ToUTF8 on the GetAttribute:

    TDOMElement(childNode).SetAttribute('value', UTF8ToUTF16(s));
    s2 := UTF16ToUTF8(TDOMElement(childNode).GetAttribute('value'));

So for now I have a workaround until we're able to upgrade to the 3.0
compiler and use cwstring and the correct implicit conversions. I'd still
welcome any input to help me understand the difference between the two
versions though.



Seth Grover

Be kind to all of your neighbors
Because they're just like you.
And you're nothing special
Unless they are too.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20161121/bcddcdfa/attachment.html>

More information about the fpc-pascal mailing list