5

I have a program in C# that reads java properties file and get the string content of the file. and the java properties file contain a string which look like this

DICOM_Nodes=W\u0119z\u0142y DICOM

but when StreamReader reads this line,

StreamReader reader = new StreamReader(file,Encoding.UTF8);

it return the line in the same way (with the \u0119 instead of 'ę')

but if i do

string value = "W\u0119z\u0142y DICOM";

then c# understands it perfectly

sample output:

from StreamReader: W\u0119z\u0142y DICOM

from value: Węzły DICOM

anyone know how to conver the string from StreamReader to a readable form?

  • Why you don't store `ę` in file instead `\u0119`? – Hamlet Hakobyan Apr 22 '14 at 21:05
  • 2
    This code has a helper method called `DecodeEncodedNonAsciiCharacters` that appears to do what you're looking for: http://stackoverflow.com/a/1615860/231316 – Chris Haas Apr 22 '14 at 21:13
  • The `\uxxxx` part of the string is parsed by the compiler. You don't have the compiler around anymore to read that file. Buy yourself a copy of the New York Times Sunday Edition and whack that Java programmer over the head with it. If that doesn't produce a response then use this answer: – Hans Passant Apr 22 '14 at 21:36
  • Hamlet: i got the file from Translator, there are thousands of those. Chris: Thanks that's what i need! – user3562104 Apr 23 '14 at 14:41

0 Answers0