473,761 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unicode to ASCII string conversion

Ger
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 Encoding.Conver t, but that needs byte arrays.

Thanks,
/Ger
Nov 21 '05
18 34143
Jay,

Because of Ger's answer, now I become curious. I did not read it in your
message, however what is the solution, Ger told he wanted a straight string
to string conversion and explicitly no bytearray, however now I understand
he can convert Unicode to a 8 bits ANSI String in VBNet? (And I am not
talking about writing a file with 8 bits chars by decoding the char)

I showed in this thread with a link to an MSDN page that a String contains
forever 16 bits Chars.

Is that documentation wrong or do I not understand it or maybe even
something complete different..

Cor


"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> schreef in bericht
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Ger,
Ah, now I think I get the idea. So when I convert a (Unicode) string into an
ascii byte array, and then the byte array back into a string, I still have Unicode, right? Correct, just remember that you will loose some characters going to & from
ASCII.
So that is of no use when you want to write ASCII to a
filestream.

If you need an ASCII file, then use a ASCII encoding. It really depends on
what is going to read the file again.

I would recommend with an ANSI encoding (see below) or UTF8 encoding. With
ASCII you will loose all extended characters (ASCII is 7 bit encoding),

with ANSI you will loose characters that are outside of your regional ANSI code
page. UTF8 preserves all Unicode characters. I would recommend ANSI encoding if the file was going to be opened by casual users in Notepad. I would
recommend UTF8 if full Unicode support is required. ANSI & UTF8 are both 8
bit encodings.

Is the code below then writing ASCII output to my filestream?
Yes that code is writing ASCII, as you included the ASCII encoding on the
StreamWriter constructor.

The text file itself will contain ASCII characters, when you subsequently
open that text stream and read it (with a StreamReader) it will be

converted back to Unicode strings. When reading the file back try to use the same
encoding as written. For example if you wrote ANSI, then use ANSI to read.
If you wrote UTF8, then use UTF8 to read. As ANSI & UTF8 encode characters
127 to 255 differently. Remember that Encoding.UTF8 is used on the stream
writer if you do not give one, if you are reading text files created by
Notepad, then you want Encoding.Defaul t.

I would recommend:
Dim wOutput As New StreamWriter(fs Output, System.Text.Enc oding.Default)


Which will write the file in your current ANSI code page as defined by the
regional settings in Windows Control Panel. Which will preserve extended
characters.

Remember that ANSI is an 8 bit encoding that is dependent on region (code
page). While ASCII is a 7 bit encoding, ASCII does not support extended
characters such as ë. It will be converted into either a normal e or a ?.

Hope this helps
Jay

"Ger" <ge*********@ra thernospam.sail soft.nl> wrote in message
news:uU******** ******@tk2msftn gp13.phx.gbl...
Ah, now I think I get the idea. So when I convert a (unicode) string into an
ascii byte array, and then the byte array back into a string, I still have Unicode, right? So that is of no use when you want to write ASCII to a
filestream.

Is the code below then writing ASCII output to my filestream?

Dim UnicodeString As String = "abcdëfg"
Dim fsOutput as New FileStream(..)
Dim wOutput As New StreamWriter(fs Output, System.Text.Enc oding.ASCII)
wOutput.WriteLi ne(UnicodeStrin g)

Thank you for your reply.

/Ger
"Cor Ligthert" <no**********@p lanet.nl> schreef in bericht
news:eW******** ********@tk2msf tngp13.phx.gbl. ..
Ger,

> Thanks for your reply, but this returns a byte array. I ment straight
> forward string-to-string conversion. It is possible ofcourse to write a > simple function to do this and using the encoding class, but I was just > wondering why the framework does not support the "direct
string-to-string".

In the dotNet is a "String" is forever a string of unicode Chars. What
you
call "ascii string" is forever a bytearray.

Therefore as an answer there is nothing more than Herfried suggested.
Although you can create an array of objects which contains bytes, however that is no solution in my opinion.

I hope this helps to get the idea?

Cor



Nov 21 '05 #11
Ger,
I should add that I would normally use Encoding.Defaul t (ANSI) for straight
text files. I would normally use UTF8 for XML files.

Hope this helps
Jay

"Ger" <ge*********@ra thernospam.sail soft.nl> wrote in message
news:Oy******** *****@TK2MSFTNG P14.phx.gbl...
Thank you very much guys for your help and clearing up the issue for me.
I will go for Jay's solution and use ANSI 8-bit.
/Ger

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> schreef in
bericht
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Ger,
> Ah, now I think I get the idea. So when I convert a (Unicode) string into > an
> ascii byte array, and then the byte array back into a string, I still have > Unicode, right?

Correct, just remember that you will loose some characters going to &
from
ASCII.
> So that is of no use when you want to write ASCII to a
> filestream.

If you need an ASCII file, then use a ASCII encoding. It really depends
on
what is going to read the file again.

I would recommend with an ANSI encoding (see below) or UTF8 encoding.
With
ASCII you will loose all extended characters (ASCII is 7 bit encoding),

with
ANSI you will loose characters that are outside of your regional ANSI
code
page. UTF8 preserves all Unicode characters. I would recommend ANSI

encoding
if the file was going to be opened by casual users in Notepad. I would
recommend UTF8 if full Unicode support is required. ANSI & UTF8 are both
8
bit encodings.

> Is the code below then writing ASCII output to my filestream?


Yes that code is writing ASCII, as you included the ASCII encoding on the
StreamWriter constructor.

The text file itself will contain ASCII characters, when you subsequently
open that text stream and read it (with a StreamReader) it will be

converted
back to Unicode strings. When reading the file back try to use the same
encoding as written. For example if you wrote ANSI, then use ANSI to
read.
If you wrote UTF8, then use UTF8 to read. As ANSI & UTF8 encode
characters
127 to 255 differently. Remember that Encoding.UTF8 is used on the stream
writer if you do not give one, if you are reading text files created by
Notepad, then you want Encoding.Defaul t.

I would recommend:
> Dim wOutput As New StreamWriter(fs Output, System.Text.Enc oding.Default)


Which will write the file in your current ANSI code page as defined by
the
regional settings in Windows Control Panel. Which will preserve extended
characters.

Remember that ANSI is an 8 bit encoding that is dependent on region (code
page). While ASCII is a 7 bit encoding, ASCII does not support extended
characters such as ë. It will be converted into either a normal e or a ?.

Hope this helps
Jay

"Ger" <ge*********@ra thernospam.sail soft.nl> wrote in message
news:uU******** ******@tk2msftn gp13.phx.gbl...
> Ah, now I think I get the idea. So when I convert a (unicode) string into > an
> ascii byte array, and then the byte array back into a string, I still have > Unicode, right? So that is of no use when you want to write ASCII to a
> filestream.
>
> Is the code below then writing ASCII output to my filestream?
>
> Dim UnicodeString As String = "abcdëfg"
> Dim fsOutput as New FileStream(..)
> Dim wOutput As New StreamWriter(fs Output, System.Text.Enc oding.ASCII)
> wOutput.WriteLi ne(UnicodeStrin g)
>
> Thank you for your reply.
>
> /Ger
>
>
> "Cor Ligthert" <no**********@p lanet.nl> schreef in bericht
> news:eW******** ********@tk2msf tngp13.phx.gbl. ..
>> Ger,
>>
>> > Thanks for your reply, but this returns a byte array. I ment
>> > straight
>> > forward string-to-string conversion. It is possible ofcourse to
>> > write a >> > simple function to do this and using the encoding class, but I was just >> > wondering why the framework does not support the "direct
>> string-to-string".
>>
>> In the dotNet is a "String" is forever a string of unicode Chars. What
>> you
>> call "ascii string" is forever a bytearray.
>>
>> Therefore as an answer there is nothing more than Herfried suggested.
>> Although you can create an array of objects which contains bytes, however >> that is no solution in my opinion.
>>
>> I hope this helps to get the idea?
>>
>> Cor
>>
>>
>>
>
>



Nov 21 '05 #12
Cor,
Read my post. ;-) I only discussed reading & writing strings to ASCII, ANSI,
and UTF8 files (7 & 8 bit encodings).

You are correct System.String & System.Char are UTF-16 (16 bit Unicode),
files can be ANSI, ASCII, UTF7, UTF8, EBCDIC, UTF16 and many other
encodings.
FWIW: VS.NET 2005 (.NET 2.0, aka Whidbey, due out in 2005) appears to
support UTF-32 encoding for files.

http://msdn2.microsoft.com/library/ts575t62.aspx

Hope this helps
Jay
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Jay,

Because of Ger's answer, now I become curious. I did not read it in your
message, however what is the solution, Ger told he wanted a straight
string
to string conversion and explicitly no bytearray, however now I understand
he can convert Unicode to a 8 bits ANSI String in VBNet? (And I am not
talking about writing a file with 8 bits chars by decoding the char)

I showed in this thread with a link to an MSDN page that a String contains
forever 16 bits Chars.

Is that documentation wrong or do I not understand it or maybe even
something complete different..

Cor


"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> schreef in
bericht
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Ger,
> Ah, now I think I get the idea. So when I convert a (Unicode) string into > an
> ascii byte array, and then the byte array back into a string, I still have > Unicode, right?

Correct, just remember that you will loose some characters going to &
from
ASCII.
> So that is of no use when you want to write ASCII to a
> filestream.

If you need an ASCII file, then use a ASCII encoding. It really depends
on
what is going to read the file again.

I would recommend with an ANSI encoding (see below) or UTF8 encoding.
With
ASCII you will loose all extended characters (ASCII is 7 bit encoding),

with
ANSI you will loose characters that are outside of your regional ANSI
code
page. UTF8 preserves all Unicode characters. I would recommend ANSI

encoding
if the file was going to be opened by casual users in Notepad. I would
recommend UTF8 if full Unicode support is required. ANSI & UTF8 are both
8
bit encodings.

> Is the code below then writing ASCII output to my filestream?


Yes that code is writing ASCII, as you included the ASCII encoding on the
StreamWriter constructor.

The text file itself will contain ASCII characters, when you subsequently
open that text stream and read it (with a StreamReader) it will be

converted
back to Unicode strings. When reading the file back try to use the same
encoding as written. For example if you wrote ANSI, then use ANSI to
read.
If you wrote UTF8, then use UTF8 to read. As ANSI & UTF8 encode
characters
127 to 255 differently. Remember that Encoding.UTF8 is used on the stream
writer if you do not give one, if you are reading text files created by
Notepad, then you want Encoding.Defaul t.

I would recommend:
> Dim wOutput As New StreamWriter(fs Output, System.Text.Enc oding.Default)


Which will write the file in your current ANSI code page as defined by
the
regional settings in Windows Control Panel. Which will preserve extended
characters.

Remember that ANSI is an 8 bit encoding that is dependent on region (code
page). While ASCII is a 7 bit encoding, ASCII does not support extended
characters such as ë. It will be converted into either a normal e or a ?.

Hope this helps
Jay

"Ger" <ge*********@ra thernospam.sail soft.nl> wrote in message
news:uU******** ******@tk2msftn gp13.phx.gbl...
> Ah, now I think I get the idea. So when I convert a (unicode) string into > an
> ascii byte array, and then the byte array back into a string, I still have > Unicode, right? So that is of no use when you want to write ASCII to a
> filestream.
>
> Is the code below then writing ASCII output to my filestream?
>
> Dim UnicodeString As String = "abcdëfg"
> Dim fsOutput as New FileStream(..)
> Dim wOutput As New StreamWriter(fs Output, System.Text.Enc oding.ASCII)
> wOutput.WriteLi ne(UnicodeStrin g)
>
> Thank you for your reply.
>
> /Ger
>
>
> "Cor Ligthert" <no**********@p lanet.nl> schreef in bericht
> news:eW******** ********@tk2msf tngp13.phx.gbl. ..
>> Ger,
>>
>> > Thanks for your reply, but this returns a byte array. I ment
>> > straight
>> > forward string-to-string conversion. It is possible ofcourse to
>> > write a >> > simple function to do this and using the encoding class, but I was just >> > wondering why the framework does not support the "direct
>> string-to-string".
>>
>> In the dotNet is a "String" is forever a string of unicode Chars. What
>> you
>> call "ascii string" is forever a bytearray.
>>
>> Therefore as an answer there is nothing more than Herfried suggested.
>> Although you can create an array of objects which contains bytes, however >> that is no solution in my opinion.
>>
>> I hope this helps to get the idea?
>>
>> Cor
>>
>>
>>
>
>



Nov 21 '05 #13
Ger
Jay,
Actually the reason I bothered this group with my question was because my
app generates and writes HTML data to a file believing it would be
interpreted by the browser as ASCII by setting charset=windows-1252 in the
meta tag of the htlm head.
Then I found that certain diacritical characters were not well interpreted
by the browser, and I found that that was because of the characters in the
generated stream were delivered as Unicode. After changing the meta tag in
the HTML code to charset=UTF-8 all was fine, but it left me with the
question on how these things work, hence why there was no simple
string-to-string conversion in the framework.
Your and Cor's replies made me understand better how these things work in
..Net, and I thank you both for your help in this.
/Ger

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> schreef in bericht
news:uO******** ******@TK2MSFTN GP11.phx.gbl...
Ger,
I should add that I would normally use Encoding.Defaul t (ANSI) for straight text files. I would normally use UTF8 for XML files.

Hope this helps
Jay

"Ger" <ge*********@ra thernospam.sail soft.nl> wrote in message
news:Oy******** *****@TK2MSFTNG P14.phx.gbl...
Thank you very much guys for your help and clearing up the issue for me.
I will go for Jay's solution and use ANSI 8-bit.
/Ger

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> schreef in
bericht
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Ger,
> Ah, now I think I get the idea. So when I convert a (Unicode) string

into
> an
> ascii byte array, and then the byte array back into a string, I still

have
> Unicode, right?
Correct, just remember that you will loose some characters going to &
from
ASCII.

> So that is of no use when you want to write ASCII to a
> filestream.
If you need an ASCII file, then use a ASCII encoding. It really depends
on
what is going to read the file again.

I would recommend with an ANSI encoding (see below) or UTF8 encoding.
With
ASCII you will loose all extended characters (ASCII is 7 bit encoding),

with
ANSI you will loose characters that are outside of your regional ANSI
code
page. UTF8 preserves all Unicode characters. I would recommend ANSI

encoding
if the file was going to be opened by casual users in Notepad. I would
recommend UTF8 if full Unicode support is required. ANSI & UTF8 are both 8
bit encodings.
> Is the code below then writing ASCII output to my filestream?

Yes that code is writing ASCII, as you included the ASCII encoding on the StreamWriter constructor.

The text file itself will contain ASCII characters, when you subsequently open that text stream and read it (with a StreamReader) it will be

converted
back to Unicode strings. When reading the file back try to use the same
encoding as written. For example if you wrote ANSI, then use ANSI to
read.
If you wrote UTF8, then use UTF8 to read. As ANSI & UTF8 encode
characters
127 to 255 differently. Remember that Encoding.UTF8 is used on the stream writer if you do not give one, if you are reading text files created by
Notepad, then you want Encoding.Defaul t.

I would recommend:

> Dim wOutput As New StreamWriter(fs Output, System.Text.Enc oding.Default)
Which will write the file in your current ANSI code page as defined by
the
regional settings in Windows Control Panel. Which will preserve extended characters.

Remember that ANSI is an 8 bit encoding that is dependent on region (code page). While ASCII is a 7 bit encoding, ASCII does not support extended
characters such as ë. It will be converted into either a normal e or a ?.
Hope this helps
Jay

"Ger" <ge*********@ra thernospam.sail soft.nl> wrote in message
news:uU******** ******@tk2msftn gp13.phx.gbl...
> Ah, now I think I get the idea. So when I convert a (unicode) string

into
> an
> ascii byte array, and then the byte array back into a string, I still

have
> Unicode, right? So that is of no use when you want to write ASCII to a > filestream.
>
> Is the code below then writing ASCII output to my filestream?
>
> Dim UnicodeString As String = "abcdëfg"
> Dim fsOutput as New FileStream(..)
> Dim wOutput As New StreamWriter(fs Output, System.Text.Enc oding.ASCII)
> wOutput.WriteLi ne(UnicodeStrin g)
>
> Thank you for your reply.
>
> /Ger
>
>
> "Cor Ligthert" <no**********@p lanet.nl> schreef in bericht
> news:eW******** ********@tk2msf tngp13.phx.gbl. ..
>> Ger,
>>
>> > Thanks for your reply, but this returns a byte array. I ment
>> > straight
>> > forward string-to-string conversion. It is possible ofcourse to
>> > write

a
>> > simple function to do this and using the encoding class, but I was

just
>> > wondering why the framework does not support the "direct
>> string-to-string".
>>
>> In the dotNet is a "String" is forever a string of unicode Chars. What >> you
>> call "ascii string" is forever a bytearray.
>>
>> Therefore as an answer there is nothing more than Herfried suggested. >> Although you can create an array of objects which contains bytes,

however
>> that is no solution in my opinion.
>>
>> I hope this helps to get the idea?
>>
>> Cor
>>
>>
>>
>
>



Nov 21 '05 #14
Ger,
interpreted by the browser as ASCII by setting charset=windows-1252 in the charset=windows-1252 is ANSI, not ASCII!

If you use Encoding.Defaul t you will (normally) wind up with windows-1252 in
the US and some of Europe.

Try the following:

Debug.WriteLine (System.Text.En coding.Default. EncodingName, "encoding
name")
Debug.WriteLine (System.Text.En coding.Default. BodyName, "body name")
Debug.WriteLine (System.Text.En coding.Default. HeaderName, "header
name")
Debug.WriteLine (System.Text.En coding.Default. WebName, "web name")
Debug.WriteLine (System.Text.En coding.Default. CodePage, "code page")
Debug.WriteLine (System.Text.En coding.Default. WindowsCodePage ,
"windows code page")

I would expect Encoding.Defaul t with charset = Encoding.Defaul t.WebName
should give you the effect you desire, with any regional settings.

Of course UTF8 will preserve ALL unicode characters in your output (good for
XML & HTML).

Hope this helps
Jay

"Ger" <ge*********@ra thernospam.sail soft.nl> wrote in message
news:un******** ******@TK2MSFTN GP11.phx.gbl... Jay,
Actually the reason I bothered this group with my question was because my
app generates and writes HTML data to a file believing it would be
interpreted by the browser as ASCII by setting charset=windows-1252 in the
meta tag of the htlm head.
Then I found that certain diacritical characters were not well interpreted
by the browser, and I found that that was because of the characters in the
generated stream were delivered as Unicode. After changing the meta tag in
the HTML code to charset=UTF-8 all was fine, but it left me with the
question on how these things work, hence why there was no simple
string-to-string conversion in the framework.
Your and Cor's replies made me understand better how these things work in
.Net, and I thank you both for your help in this.
/Ger

"Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> schreef in
bericht
news:uO******** ******@TK2MSFTN GP11.phx.gbl...
Ger,
I should add that I would normally use Encoding.Defaul t (ANSI) for

straight
text files. I would normally use UTF8 for XML files.

Hope this helps
Jay

"Ger" <ge*********@ra thernospam.sail soft.nl> wrote in message
news:Oy******** *****@TK2MSFTNG P14.phx.gbl...
> Thank you very much guys for your help and clearing up the issue for
> me.
> I will go for Jay's solution and use ANSI 8-bit.
> /Ger
>
> "Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> schreef in
> bericht
> news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
>> Ger,
>> > Ah, now I think I get the idea. So when I convert a (Unicode) string
> into
>> > an
>> > ascii byte array, and then the byte array back into a string, I
>> > still
> have
>> > Unicode, right?
>> Correct, just remember that you will loose some characters going to &
>> from
>> ASCII.
>>
>> > So that is of no use when you want to write ASCII to a
>> > filestream.
>> If you need an ASCII file, then use a ASCII encoding. It really
>> depends
>> on
>> what is going to read the file again.
>>
>> I would recommend with an ANSI encoding (see below) or UTF8 encoding.
>> With
>> ASCII you will loose all extended characters (ASCII is 7 bit
>> encoding),
> with
>> ANSI you will loose characters that are outside of your regional ANSI
>> code
>> page. UTF8 preserves all Unicode characters. I would recommend ANSI
> encoding
>> if the file was going to be opened by casual users in Notepad. I would
>> recommend UTF8 if full Unicode support is required. ANSI & UTF8 are both >> 8
>> bit encodings.
>>
>>
>> > Is the code below then writing ASCII output to my filestream?
>>
>> Yes that code is writing ASCII, as you included the ASCII encoding on the >> StreamWriter constructor.
>>
>> The text file itself will contain ASCII characters, when you subsequently >> open that text stream and read it (with a StreamReader) it will be
> converted
>> back to Unicode strings. When reading the file back try to use the
>> same
>> encoding as written. For example if you wrote ANSI, then use ANSI to
>> read.
>> If you wrote UTF8, then use UTF8 to read. As ANSI & UTF8 encode
>> characters
>> 127 to 255 differently. Remember that Encoding.UTF8 is used on the stream >> writer if you do not give one, if you are reading text files created
>> by
>> Notepad, then you want Encoding.Defaul t.
>>
>> I would recommend:
>>
>> > Dim wOutput As New StreamWriter(fs Output, System.Text.Enc oding.Default) >>
>> Which will write the file in your current ANSI code page as defined by
>> the
>> regional settings in Windows Control Panel. Which will preserve extended >> characters.
>>
>> Remember that ANSI is an 8 bit encoding that is dependent on region (code >> page). While ASCII is a 7 bit encoding, ASCII does not support
>> extended
>> characters such as ë. It will be converted into either a normal e or a ?. >>
>> Hope this helps
>> Jay
>>
>> "Ger" <ge*********@ra thernospam.sail soft.nl> wrote in message
>> news:uU******** ******@tk2msftn gp13.phx.gbl...
>> > Ah, now I think I get the idea. So when I convert a (unicode) string
> into
>> > an
>> > ascii byte array, and then the byte array back into a string, I
>> > still
> have
>> > Unicode, right? So that is of no use when you want to write ASCII to a >> > filestream.
>> >
>> > Is the code below then writing ASCII output to my filestream?
>> >
>> > Dim UnicodeString As String = "abcdëfg"
>> > Dim fsOutput as New FileStream(..)
>> > Dim wOutput As New StreamWriter(fs Output,
>> > System.Text.Enc oding.ASCII)
>> > wOutput.WriteLi ne(UnicodeStrin g)
>> >
>> > Thank you for your reply.
>> >
>> > /Ger
>> >
>> >
>> > "Cor Ligthert" <no**********@p lanet.nl> schreef in bericht
>> > news:eW******** ********@tk2msf tngp13.phx.gbl. ..
>> >> Ger,
>> >>
>> >> > Thanks for your reply, but this returns a byte array. I ment
>> >> > straight
>> >> > forward string-to-string conversion. It is possible ofcourse to
>> >> > write
> a
>> >> > simple function to do this and using the encoding class, but I
>> >> > was
> just
>> >> > wondering why the framework does not support the "direct
>> >> string-to-string".
>> >>
>> >> In the dotNet is a "String" is forever a string of unicode Chars. What >> >> you
>> >> call "ascii string" is forever a bytearray.
>> >>
>> >> Therefore as an answer there is nothing more than Herfried suggested. >> >> Although you can create an array of objects which contains bytes,
> however
>> >> that is no solution in my opinion.
>> >>
>> >> I hope this helps to get the idea?
>> >>
>> >> Cor
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Nov 21 '05 #15
Jay,
If you use Encoding.Defaul t you will (normally) wind up with windows-1252 in the US and some of Europe.

I think that I have confused you, therefore I have checked it, as far as I
can see it is only not used in the Cyriclic writing European countries.

See the link bellow

And I miss even some languages on that as from Kroatia, Slovenia (Miha),
Slowaaks and I am in doubt about Turkish

So probably European countries which not uses 1252 are where is spoken
Greek
Rumanian (retroromanish is one of the 4 in Swiss spoken languages)
Serbians,
Hertza/Bosnie,
Russian

Look at the bottom of the page, the page is in German however I think easy
to understand

http://de.wikipedia.org/wiki/Windows-1252#Windows-1252

So next time you can in my opinion write "most European"

I hope this gives again some ideas

Cor
Nov 21 '05 #16
Cor,
Aren't some of the European countries one of two encodings, such as the
Netherlands? Or is that just the DOS code page? (Trying to remember
something I thought you've stated before).

Jay

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:el******** ******@TK2MSFTN GP10.phx.gbl...
Jay,
If you use Encoding.Defaul t you will (normally) wind up with windows-1252

in
the US and some of Europe.

I think that I have confused you, therefore I have checked it, as far as I
can see it is only not used in the Cyriclic writing European countries.

See the link bellow

And I miss even some languages on that as from Kroatia, Slovenia (Miha),
Slowaaks and I am in doubt about Turkish

So probably European countries which not uses 1252 are where is spoken
Greek
Rumanian (retroromanish is one of the 4 in Swiss spoken languages)
Serbians,
Hertza/Bosnie,
Russian

Look at the bottom of the page, the page is in German however I think easy
to understand

http://de.wikipedia.org/wiki/Windows-1252#Windows-1252

So next time you can in my opinion write "most European"

I hope this gives again some ideas

Cor

Nov 21 '05 #17
Jay,

Therefore I checked it, I have confused you where I was talking about the
DOS 437 and 850 code page and you never knew what was used, however we use
now probably all the 1252.

Cor
Aren't some of the European countries one of two encodings, such as the
Netherlands? Or is that just the DOS code page? (Trying to remember
something I thought you've stated before).

Nov 21 '05 #18
br............. ...
Therefore I checked it, I have confused you where I was talking about the
DOS 437 and 850 code page and you never knew what was used, however we use now probably all the 1252.


That "you" never knew is not Jay, just as saying.
Nov 21 '05 #19

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

Similar topics

6
2036
by: Willem | last post by:
What is the best way to calculate an ascii string into an integer (not talking about an atoi conversion): For examle if I have the ascii string: "/b" then in hex it would be 2F7A and if I convert that to decimal I would get 12154. I can't figure out how to concatenate? my hex values together if that makes any sense? Any pointers would be greatly appreciated!
1
1839
by: N | last post by:
Hi, I'm writing a small web service (using C#) which is going to receive a text file, add a line to it and send it back. Input is a string with each line ending with "\r\n". The problem is in the format of the output - looks like all ends of lines are missing, even if web service just receives and sends back the same string. Could it be some encoding issue?
19
3336
by: Thomas W | last post by:
I'm getting really annoyed with python in regards to unicode/ascii-encoding problems. The string below is the encoding of the norwegian word "fødselsdag". I stored the string as "fødselsdag" but somewhere in my code it got translated into the mess above and I cannot get the original string back. It cannot be printed in the console or written a plain text-file. I've tried to convert it using
2
3322
by: John Nagle | last post by:
I'm trying to clean up a bad ASCII string, one read from a web page that is supposedly in the ASCII character set but has some characters above 127. And I get this: File "D:\projects\sitetruth\InfoSitePage.py", line 285, in httpfetch sitetext = sitetext.encode('ascii','replace') # force to clean ASCII UnicodeDecodeError: 'ascii' codec can't decode byte 0x92 in position 29151: ordinal not in range(128)
9
15739
by: thijs.braem | last post by:
Hi everyone, I'm having quite some troubles trying to convert Unicode to String (for use in psycopg, which apparently doesn't know how to cope with unicode strings). The error I keep having is something like this: ERREUR: Séquence d'octets invalide pour le codage «UTF8» : 0xe02063 (sorry, locale is french, it means "byte sequence invalid for encoding
4
2242
by: vcnewbie | last post by:
Hi I'm maintaining a VisualC++ project to increase its security regarding stored passwords. I thought about using SHA256Managed to create a hash for the password when creating a user and when this new user tries to login, a new hash will be created for the given password and compared to the stored hash. I guess this is quite common.
0
9989
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8814
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.