Re: Problem writing non-englisg characters (re-post)

Tech-Archive recommends: Speed Up your PC by fixing your registry



Sorry, i have not delebrately posted another thread, its cause i was
selecting "Reply" instead of "Reply Group" and did not have a proper e-mail
address setup and hence my message was not going through.

Now regarding the issue

How do i read from a website which has those odd characters like
"élémentaire" and then write them to a file.

do i use UTF8Encoding (default) or someother encoding for both reading and
writing these type of characters. Could you point me to some code or give
some idea.


"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:60d8701f-1670-481c-986f-73939e4a2f48@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Feb 11, 11:37 am, "barry" <some...@xxxxxxxxxxxxx> wrote:
Thanks for your reply.

It's generally a good idea to keep all posts within the same thread
rather than starting a new thread each time.

I am parsing a French website, i found that it reads the characters
correctly when i open the .html file using

TextReader tr = new StreamReader("XYZ.htm", new UTF7Encoding(true)) ;

That sounds unlikely. UTF-7 is used in very specific circumstances
(mail, IIRC).

How are you validating that it's reading the characters correctly?

if am able to parse the data correctly, i have checked this using the
Visual
Studio 2003 Debugger, problem arises after writing the data to file which
i
open using

TextWriter tw = new StreamWriter("zxy.txt", false, new
UTF7Encoding(true));
tw.WriteLine("", new UTF7Encoding(true));
tw.close();

You really don't want to be using UTF7, either for reading or writing.

Jon


.



Relevant Pages

  • Re: Rambling: the info (+ experiment on reader reaction)
    ... into writing her version of their stories. ... normal and nothing to object to for the characters, ... the fun of reading is the discovery. ... I come to books wanting to enjoy them. ...
    (rec.arts.sf.composition)
  • Re: Reading depends on writing, in Chinese
    ... > listening, speaking, reading, and writing. ... The Chinese language provides a unique medium for testing this ... because logographic characters in Chinese are based on meaning ...
    (sci.lang)
  • Re: What Are the Great SF Novels of the 1990s?
    ... If any one of the three is exceptional, it makes it fairly easy to ignore the other two - although good writing seldom stands on its own. ... If the writing is bad but I like the characters, or the story intrigues me, I'll continue reading to find out what happens, if nothing else. ... This was the case for me when reading Brian Daley's Gammalaw ) - I found it difficult to read, but I wanted to know what happened to the characters, who interested me. ...
    (rec.arts.sf.written)
  • Re: Problem writing non-englisg characters (re-post)
    ... It's generally a good idea to keep all posts within the same thread ... correctly when i open the .html file using ... You really don't want to be using UTF7, either for reading or writing. ...
    (microsoft.public.dotnet.framework)
  • Re: Which language should I learn?
    ... > needed to learn any reading and writing ability to near native proficiency. ... Although characters occasionally have radicals which hint at ... the multiple tones which need to be mastered to speak the language ...
    (sci.lang)