473,396 Members | 1,760 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,396 software developers and data experts.

Read unicode text file

8
Hello All!

I have a problem with reading unicode txt file from VC++ project. I despaired already. :( May be you could help me?

Thank a lot in advance,
Marina
May 9 '07 #1
8 9204
DeMan
1,806 1GB
Could you please elaborate on the problem.....
Specifically: Do you just need to parse into ascii like characters, or do you specifically need to be able to read/display more obscure characters
May 9 '07 #2
Mariii
8
Could you please elaborate on the problem.....
Specifically: Do you just need to parse into ascii like characters, or do you specifically need to be able to read/display more obscure characters
I need to read the file till the end, file looks like:
Expand|Select|Wrap|Line Numbers
  1. text1;something;something
  2. text2;something;something
  3. text3;something;something
  4. text4;something;something
And I need to parse every row and to form the vector based on these data.
May 9 '07 #3
Mariii
8
I found this. But I cann't believe, that it is the only way to read this bloody unicode text file! It should be other way!
May 9 '07 #4
DeMan
1,806 1GB
Ultimately a file is just a collection of bits so how you want to read it depends depends on what you want to do with it. If you know that you will be reading converted ascii characters only, then you simply read characters ignoring NULL. If you actually want to process information as Unicode the story gets a little harder.
May 9 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
Have you tried using a wifstream object?
May 9 '07 #6
Mariii
8
Ultimately a file is just a collection of bits so how you want to read it depends depends on what you want to do with it. If you know that you will be reading converted ascii characters only, then you simply read characters ignoring NULL. If you actually want to process information as Unicode the story gets a little harder.
I need to process reading information, but it's not necessary to do it in unicode. How can I read ignoring NULL? When I try to read with CStdioFile I can't get even the whole row. Should I do it with istream operators?
May 10 '07 #7
Mariii
8
Have you tried using a wifstream object?
Not yet, but I try to try it.
May 10 '07 #8
Mariii
8
Have you tried using a wifstream object?
I still read only nonsense symbols with it:

Expand|Select|Wrap|Line Numbers
  1. wchar_t wcht[1024];
  2. char *cfn = "C:\\test.csv";
  3. wifstream wifstrm(cfn, ios_base::in);
  4. wifstrm.getline(wcht,1024,'\n');
May 10 '07 #9

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

Similar topics

4
by: Achim Domma | last post by:
Hi, I read some text from a utf-8 encoded text file like this: text = codecs.open('example.txt','r','utf8').read() If I pass this text to a COM object, I can see that there is still the BOM...
17
by: Guyon Morée | last post by:
what is the difference? if I open a text file in binary (rb) mode, it doesn't matter... the read() output is the same.
3
by: hunterb | last post by:
I have a file which has no BOM and contains mostly single byte chars. There are numerous double byte chars (Japanese) which appear throughout. I need to take the resulting Unicode and store it in a...
2
by: hezhenjie | last post by:
Hi, all: I just need to parse a unicode file, and assume to get data one line by one line. I use _wfopen(), fgetws(), wcslen(), wcsstr(), making it work normally on Windows platform. However,...
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...
10
by: Tibby | last post by:
I need to read/write not only text files, but binary as well. It seems like on binary files, it doesn't right the last 10% of the file. -- Thanks --- Outgoing mail is certified Virus...
0
by: Ahmed A. | last post by:
This will be very helpfull for many! Using RichTextBox Read/Write Unicode File http://www.microsoft.com/indonesia/msdn/wnf_RichTextBox.as p Private Function ReadFile(ByVal myfile As String)...
2
by: starffly | last post by:
I want to read a xml file in Unicode, UTF-8 or a native encoding into a wchar_t type string, so i write a routine as follows, however, sometimes a Unicode file including Chinese character cannot...
14
by: Zoro | last post by:
My task is to read html files from disk and save them onto SQL Server database field. I have created an nvarchar(max) field to hold them. The problem is that some characters, particularly html...
0
by: Steve Holden | last post by:
ganesh gajre wrote: You are getting too ambitious. Text files don't have any font information associated with them. Not only that, but the encoding of Unicode character data is independent of...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.