Re: [xml-dev] Unicode problems with XML and HTML files

Adrian Herscu <[email protected]> Fri, 27 Dec 2002 02:03:25 +0200
Newsgroups gmane.comp.java.netbeans.modules.xml.devel
Organization CollabNet Hosting
Message-ID <[email protected]>
Petr Kuzel wrote:
> Adrian Herscu wrote:
> 
> 
>>Hi all,
>>
>>Using NetBeans 3.4:
>>
>>1) Saving XML documents:
>>Why XML documents encoded as UTF-8 are saved as ANSI encoded?
> 
> 
> They should not be. Can you reproduce it? What about characters
> that do not have proper representation in ASCII? What about
> other encodings? What's your JDK? .....
>  
1) Reproduction steps:
a. Create a XML file;
b. Set UTF-8 encoding using the customizer;
c. Save it;
d. Open it using Windows/Notepad;
e. File/Save as...  - the encoding will show ANSI (not UTF-8);
f. Change to UTF-8 and save;
g. Check XML (using the IDE) - you'll get an error:
"Document root element is missing. [1] "
that's because the file is read as ASCII encoded, while it is UTF-8 
encoded - so it appears that it contains a few illegal characters at the 
begining (those signal for UTF encoding).
2) I didn't use any characters above the 127 code - all plain English!
3) I did try UTF-16 with XML files and it apparently works (it saves as 
little-endian - may be that's because I'm running on Windows?)
4) JDK: Java Hotspot Client 1.4.0-b92


> 
>>2) Loading HTML documents:
>>Why HTML documents encoded as UTF-16 cannot be properly loaded?
> 
> 
> I guess that HTML module does not support it. It's way harder
> to properly detect and handle encodings for HTML than for XML.
> 
>   Cc.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]