Extended ASCII Code

Hello,

The following returns me: 101

Dim m As String = ""
Dim code As Integer = m.ConvertEncoding( Encodings.ASCII ).AscB
MsgBox Str(code)

Is it possible to return: 136 (ASCII Extended) ?

ASCII Extended Table: http://www.asciitable.com/

there’s no such thing as “extended ascii” - that site is unfortunately ONLY useful for the basic ascii set as the remainder depends on what single byte encoding they are trying to show (turns out it looks like DOSLatin1)

What there are is a number of single byte text encodings that all use ASCII as the code points from 0-127 but then have different “characters” for code points from 128-255

Try

Dim m As String = ""
Dim code As Integer = m.ConvertEncoding(Encodings.DOSLatin1).AscB
MsgBox Str(code)

[quote=114628:@Walter Sander]Hello,

The following returns me: 101

Dim m As String = "ê"
Dim code As Integer = m.ConvertEncoding( Encodings.ASCII ).AscB
MsgBox Str(code)

Is it possible to return: 136 (ASCII Extended) ?

ASCII Extended Table: http://www.asciitable.com/[/quote]

Use a dictionary to convert Encodings.ASCII to CP-437 codes (what the site wants you to believe is the standard and has not been since 1984) . Here with ê and ü

dim d as new Dictionary d.value(101) = 136 d.value(117) = 129 Dim m As String = "ê" Dim code As Integer = m.ConvertEncoding( Encodings.ASCII ).AscB MsgBox Str(code)+" "+str(d.value(code))

You feed once the values and codes for each accented characters and you got it :slight_smile:

Might be a good idea to move this to General.

Norman, thank you. I learned something with Encodings.DOSLatin1 :slight_smile:

I should have gazed at the Encodings page before. Everything but the kitchen sink is there :wink:

[quote=114636:@Michel Bujardet]Use a dictionary to convert Encodings.ASCII to CP-437 codes (what the site wants you to believe is the standard and has not been since 1984) . Here with ê and ü

dim d as new Dictionary d.value(101) = 136 d.value(117) = 129 Dim m As String = "ê" Dim code As Integer = m.ConvertEncoding( Encodings.ASCII ).AscB MsgBox Str(code)+" "+str(d.value(code))

You feed once the values and codes for each accented characters and you got it :)[/quote]

Personally I wouldn’t do this & would just use the correct encoding - DOSLatinUS (which is cp437)

Dim m As String = "ê"
Dim code As Integer = m.ConvertEncoding(Encodings.DOSLatinUS).AscB
MsgBox Str(code)

[quote=114641:@Michel Bujardet]Norman, thank you. I learned something with Encodings.DOSLatin1 :slight_smile:

I should have gazed at the Encodings page before. Everything but the kitchen sink is there ;)[/quote]

And if it isn’t you can get it from a code - http://documentation.xojo.com/index.php/Encodings.GetFromCode
Or you can create it using the base & variant codes - http://documentation.xojo.com/index.php/GetTextEncoding

But the vast majority of the useful ones are in the list

The ASCII Table was never extended.

It’s an http://www.filefactory.com/file/4kq84756e3ib/R0013.zip to use these words.

What you are talking to is the 129 to 256 character codes who existed in at least 2 (one for Macintosh, one for Windows).

We have UTF-8, that is several years that we have UTF-8.