473,394 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

IO.File.ReadAllLines ANSI characters (ASCII > 127)

1
I'm using IO.File.ReadAllLines(FileName) to read all lines from text file to array of strings at once. Problem is, text lines include ANSI characters above ASCII value 127 (Scandinavian letters e.g. "Ä" (Ascii 196), "ö" (Ascii 246) and "é" (Ascii 233). Array is build up nicely, but all chars above ascii value 127 are not shown right. How can I use ANSI character set with .ReadAllLines to correct this problem? In VB6 with "Open Filename For Input As #1 / Line Input #1, txtLine" there wasn't any problem.
Any suggestions? Thank's.

OBS: This is already solved, found the answer by myself:

Dim myEncoding As Encoding = System.Text.Encoding.GetEncoding(1252) ' Windows-1252

Dim strLibrary As String() = IO.File.ReadAllLines(FileName, myEncoding)

Problem was to find right character set, which was Windows-1251 (ISO-8859-1)
Feb 14 '12 #1
1 7818
!NoItAll
297 100+
Thank you for posting the solution! It's über annoying when someone asks a question and then comes back and only says: "I figured it out" without posting the solution they figured out.
- it just creates noise on the Internet that already suffers from a really bad signal to noise ratio...
Thanks for posting the solution!

Des
Feb 17 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: James Gregory | last post by:
I read that the argument to isdigit() can be "an integer whose value is representable as an unsigned char, or the value of the macro EOF.". This seems to say that it should work for values greater...
1
by: Curt Fluegel | last post by:
I seem to be having a problem base64 encoding characters above 127. I can encode a sentence like "The big bad dog" without problems, but if I try to encode something like 0xFF I get different...
3
by: sjoshi | last post by:
I'm doig a test using XP English with LocalSettings set to Russian. When trying to open an XML file with ANSI encoding, I get errors. When I change the encoding to UTF8, I can read the file...
4
by: Kueishiong Tu | last post by:
I have a text file with wide characters. I use the following C++ code to read them in. However the wide characters are not read in properly. What is wrong? String* path = "C:\\Documents and...
2
by: not aaron | last post by:
I start out with a string. Which I then encode with my own algorithm changing every characters ascii value depending on a key. I then save it to a binary file. When I generate the initial...
1
by: godofredo | last post by:
Hi! I've a weird problem using ReadAllLines Function. I have a plain text file which has about 6500 lines, each one representing a 3D point. I read the text file and store it in a string array...
1
by: Stefan Pascal | last post by:
Hello. I have a very strange problem on my system with running C# applications from a longer than usual (>127 chars) path. I was able to reproduce the following 2 cases: 1. Socket s = new...
6
by: Shawn | last post by:
Hello: I have the following code in a PHP file. An HTML form passes user comment data to the PHP, which then appends the user comments to the end of the HTML file on which the form is located....
7
by: firepol | last post by:
Hello there, I am dealing with files encoded in UTF8 and I can't find a way to convert them into ANSI. I've already searched in google for this since a while, and I'm not achieving the result I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.