|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Strange character transformationsI have an ASP.Net website, which allows users to upload a file which is then inserted into a database. This is all fine until it reads a line with the string +Anu in it. It transforms this to this char É» (which, if Googled for, is described as Unicode Character 'LATIN SMALL LETTER TURNED R WITH HOOK' (U+027B) or, in Phonetics, as a 'Retroflex approximant'.) Has anyone seen this behaviour before, and know how to stop it? The code's simple - here's an example. The É» appears in the output where the input is +Anu - it's transformed before I can touch it! using (StreamReader sr = new StreamReader(strFile, System.Text.Encoding.UTF7)) { // Read and display lines from the file until the end of the file is reached. while ((line = sr.ReadLine()) != null) { Response.Write(line); } } Regards Adam Looks like an encoding issue, alright.
Have you tried using the StreamReader constructor that does not require a character encoding? Show quote "CyberSpyd***@gmail.com" wrote: > Hi, > > I have an ASP.Net website, which allows users to upload a file which is > then inserted into a database. > > This is all fine until it reads a line with the string +Anu in it. > It transforms this to this char É» (which, if Googled for, is > described as Unicode Character 'LATIN SMALL LETTER TURNED R WITH HOOK' > (U+027B) or, in Phonetics, as a 'Retroflex approximant'.) > > Has anyone seen this behaviour before, and know how to stop it? > The code's simple - here's an example. The É» appears in the output > where the input is +Anu - it's transformed before I can touch it! > > using (StreamReader sr = new StreamReader(strFile, > System.Text.Encoding.UTF7)) { > // Read and display lines from the file until the end of the file is > reached. > while ((line = sr.ReadLine()) != null) { > Response.Write(line); > } > } > > Regards > > Adam > > |
|||||||||||||||||||||||