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

Unicode -- missing Spanish chars

I was under the impression that all the string and file handling methods in
vb.net defaulted to UTF-8. I am losing chars and I don't know why.

Dim fs As New FileStream(MyFilename, FileMode.Open, FileAccess.Read,
FileShare.None)
Dim Reader As New StreamReader(fs)
Dim StrList As String

If FileExists(MyFilename) Then
StrList = Reader.ReadToEnd
Reader.Close()
fs.Close()

File being read in: "Las telarañas de Carlota"
After read, StrList = "Las telaraas de Carlota" (note missing "ñ")

Can anybody help?
Nov 19 '05 #1
1 1098
Chip wrote:
I was under the impression that all the string and file handling
methods in vb.net defaulted to UTF-8.
That's not true. .NET strings use UTF-16 internally. File I/O uses
UTF-8 implicitly only if use the default StreamWriter or StreamReader
constructors or helper methods like File.OpenText().
I am losing chars and I don't know why. Dim fs As New FileStream(MyFilename, FileMode.Open, FileAccess.Read,
FileShare.None) Dim Reader As New StreamReader(fs)
Dim StrList As String

If FileExists(MyFilename) Then
StrList = Reader.ReadToEnd
Reader.Close()
fs.Close()

File being read in: "Las telarañas de Carlota"
After read, StrList = "Las telaraas de Carlota" (note missing "ñ")

Can anybody help?


That means that the original file is not UTF-8 encoded. Try using a
StreamReader with a different encoding like Windows-1252.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Silvio Lopes de Oliveira | last post by:
Hello, I use Unicode in my program to enter data in Chinese into a nvarchar field. When inserting or updating records, my application does not use Unicode escape sequences but rather the Unicode...
48
by: Zenobia | last post by:
Recently I was editing a document in GoLive 6. I like GoLive because it has some nice features such as: * rewrite source code * check syntax * global search & replace (through several files at...
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...
4
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
7
by: Robert | last post by:
Hello, I'm using Pythonwin and py2.3 (py2.4). I did not come clear with this: I want to use win32-fuctions like win32ui.MessageBox, listctrl.InsertItem ..... to get unicode strings on the...
40
by: apprentice | last post by:
Hello, I'm writing an class library that I imagine people from different countries might be interested in using, so I'm considering what needs to be provided to support foreign languages,...
5
by: grawsha2000 | last post by:
Hi, I'm trying to save unicode chars. in byte array. The problem is when I try retrieve the saved chars back from the array I get different chars from the one I saved. Code: dim uni as...
7
by: 7stud | last post by:
Based on this example and the error: ----- u_str = u"abc\u9999" print u_str UnicodeEncodeError: 'ascii' codec can't encode character u'\u9999' in position 3: ordinal not in range(128) ------
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.