Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Closed Points: 60 Time: 05:25 - Apr 07, 2007
dustPuppy
I have a text file (.txt) which apparently is not UTF-8 encoded. When I read it in C#.net with a streamreader, some characters are lost like "Ç". When I open the file with notepad, the character is there. So I suppose that it's some other encoding, but I don't know how to detect it?
Categories:
Add Categories
When adding more than one category, separate them with commas.
PeterNZ
Date:: Apr 09, 2007
Time:: 17:15
Have a look at this article. This might help you: http://www.codeproject.com/useritems/Det... Cheers Peter
Sorry, here is another one: http://www.devhood.com/tutorials/tutoria... Cheers Peter
Date:: Apr 11, 2007
Time:: 23:37
Thanks for the link, Peter. I was actually looking for a generic, not programming way of detecting the file encoding, but I didn't find that yet. What I did find by testing with different encodings was that my text was UTF-7. So where I first was doing: StreamReader file = File.OpenText(fullfilename); I had to change it to: StreamReader file = new StreamReader(fullfilename, System.Text.Encoding.UTF7); OpenText assumes it's UTF-8. you can also create the StreamReader like this new StreamReader(fullfilename, true), the second parameter meaning that it should try and detect the encoding from the byteordermark of the file, but that didn't work in my case.
Date:: Apr 12, 2007
Time:: 14:45
Yes, I know what you mean, something like if(file.Encoding == System.Text.Encoding.UTF7) { [...] } Would be nice. Well, maybe in.Net Framework 4.0? Cheers for the points! Peter
Prajith
Date:: Jul 24, 2007
Time:: 12:52
http://msdn2.microsoft.com/en-us/netfram...
magusmao
Date:: Jan 16, 2009
Time:: 20:49
file -i <filename>
Question Answered
This question has been closed, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
How do I create a text file with UTF7 encoding in c# .net?
MySQL command line import of file with UTF-8 encoding.
You have 100 characters to use
Rank
Expert
Points
1.
10354
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software