|
Post by Thor on Mar 12, 2006 8:53:14 GMT -5
Hi. Tried reading of a file with scandinavian chars, "æøå" they where just cut off. tried the encoding option. nothing worked. went over to ado stream object to read file, all is read off.
|
|
|
Post by Kelly Ethridge on Mar 13, 2006 0:04:51 GMT -5
Could you paste your code please?
And how would I recreate the file? Or can I just copy and paste your quoted characters into WordPad and that would work fine?
|
|
|
Post by thor on Mar 14, 2006 10:39:42 GMT -5
I will post it to your mail adress. today or twomorrow.
|
|
|
Post by thor on Mar 14, 2006 20:35:11 GMT -5
Hmm okey. just checked a little closer now. it seems that the file is saved on ansi encoding. if I change to encoding to something else, the vbcorelib will read it fine. I can't see any options in encodings that is ansi. dosen't it support it?
I'm using this to read the file. Dim reader As StreamReader
' Opens a reader using a FileStream object returned from File.OpenRead. Set reader = NewStreamReader(File.OpenRead("template.mht")) Text1.Text = reader.ReadToEnd
|
|
|
Post by thor on Mar 14, 2006 20:36:53 GMT -5
|
|
|
Post by Kelly Ethridge on Mar 14, 2006 22:18:14 GMT -5
Hi, Sorry, there is no ANSI encoding. I've never looked into it since it wasn't in the DotNET library. So I'll go ahead and blame Microsoft Kelly
|
|
|
Post by Kelly Ethridge on Mar 14, 2006 22:29:20 GMT -5
Could you try this and tell me if it works?
Using this to get an Encoding
Set reader = NewStreamReader(File.OpenRead("template.mht"), Encoding.GetEncoding(1252))
This will get a custom encoding. In this case for us westerners.
|
|
|
Post by Thor on Mar 15, 2006 11:40:59 GMT -5
that worked. Thanks ;D
|
|
|
Post by Kelly Ethridge on Mar 15, 2006 23:28:01 GMT -5
That's great!
BTW you don't need to use File.OpenRead, you could just use the filename directly. A FileStream will be created automatically.
Set reader = NewStreamReader("template.mht", Encoding.GetEncoding(1252))
|
|