Andries Bos wrote:
> I use the TStringStream to read an XML file. All works well, except
> for reading the Euro sign.
>
> From within the file delicered from the customer; the euro sign is
> $AC . Reading this file within any windows viewer, It a proper E
> sign. However, within the read string from my xlm parser, it a secial
> char ( something like a  ----i  ). Exporting a Euro sign will result
> in a &#x80 and this will be re-imported properly. Viewing a E sign
> after typing it into a notepad txt, will result in a $80.
>
> Can I use  a TStringStream via the property DataString to read
> unicode characters? Browsing the internet, it seems that the char
> $20AC is to correct way to show the original eurosign.  Should I
> change my way to read unicode strings/ characters?

In certain character sets, the euro sign resides at character code $80.
In Unicode, it is at code $20ac, which is the only code an XML parser is
interested in since XML always uses Unicode.

However, an XML file may be *encoded* using any character set. The
<?xml?> processing directive at the top of the file should tell you what
encoding was used. Also consider whether the file starts with any
Unicode byte-order mark. If there is no byte-order mark, and the
processing directive has no encoding property, then you should assume
the file is encoded as UTF-8.

Your XML parser should expect a WideString as input. If it expects an
AnsiString, then it's probably not written correctly. (It *might* expect
an AnsiString encoded with UTF-8, but that's unlikely.) Read your XML
file and transcode it to be UTF-16, which is the encoding Delphi's
WideString type expects to hold. Your XML library might even have
functions for changing a string's character encoding.

--
Rob


-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED]




SPONSORED LINKS
C programming language Computer programming languages Java programming language
The c programming language C programming language Concept of programming language


YAHOO! GROUPS LINKS




Reply via email to