.Net ramblings
# Wednesday, 20 August 2008
Encoding issues with File.WriteAllText
i assumed that File.WriteAllText() would assume UTF8 encoding since all strings are unicode in .net by default, so i never bothered specifying the encoding in the 3rd parameter.  But it was causing me grief with accented characters, and i finally worked it out that i needed to specify UTF8 explicitly.
File.WriteAllText(filepath, text, Encoding.UTF8);

Wednesday, 20 August 2008 15:00:46 (GMT Daylight Time, UTC+01:00)  #    Comments [0]  .Net General

Please login with either your OpenID above, or your details below.
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview