92 lines
2.2 KiB
QBasic
92 lines
2.2 KiB
QBasic
REM ***** BASIC *****
|
|
' If it is a character we defined here,
|
|
' it gives us the uft8 as integer,
|
|
' else there is a msgbox and returns 0
|
|
'
|
|
' Use hex(i) to get the hexadecimal code from the uft8
|
|
|
|
Public Function umlautUtf8ToInt(c As String) As Integer
|
|
umlautUtf8ToInt = 0
|
|
Select Case c
|
|
Case "î"
|
|
umlautUtf8ToInt = &HC3AE
|
|
Case "ä"
|
|
umlautUtf8ToInt = &HC3A4
|
|
Case "ç"
|
|
umlautUtf8ToInt = &HC3A7
|
|
Case "Ö"
|
|
umlautUtf8ToInt = &HC396
|
|
Case "ê"
|
|
umlautUtf8ToInt = &HC3AA
|
|
Case "Ô"
|
|
umlautUtf8ToInt = &HC394
|
|
Case "û"
|
|
umlautUtf8ToInt = &HC3BB
|
|
Case "ö"
|
|
umlautUtf8ToInt = &HC3B6
|
|
Case "Â"
|
|
umlautUtf8ToInt = &HC382
|
|
Case "Æ"
|
|
umlautUtf8ToInt = &HC386
|
|
Case "ü"
|
|
umlautUtf8ToInt = &HC3BC
|
|
Case " "
|
|
umlautUtf8ToInt = &H20
|
|
Case "Ë"
|
|
umlautUtf8ToInt = &HC38B
|
|
Case "Î"
|
|
umlautUtf8ToInt = &HC38E
|
|
Case "Ê"
|
|
umlautUtf8ToInt = &HC38A
|
|
Case "Ï"
|
|
umlautUtf8ToInt = &HC38F
|
|
Case "â"
|
|
umlautUtf8ToInt = &HC3A2
|
|
Case "È"
|
|
umlautUtf8ToInt = &HC388
|
|
Case "Ä"
|
|
umlautUtf8ToInt = &HC384
|
|
Case "Ç"
|
|
umlautUtf8ToInt = &HC387
|
|
Case "Û"
|
|
umlautUtf8ToInt = &HC39B
|
|
Case "à"
|
|
umlautUtf8ToInt = &HC3A0
|
|
Case "'"
|
|
umlautUtf8ToInt = &H27
|
|
Case "ï"
|
|
umlautUtf8ToInt = &HC3AF
|
|
Case "ë"
|
|
umlautUtf8ToInt = &HC3AB
|
|
Case "ô"
|
|
umlautUtf8ToInt = &HC3B4
|
|
Case "À"
|
|
umlautUtf8ToInt = &HC380
|
|
Case "É"
|
|
umlautUtf8ToInt = &HC389
|
|
Case "æ"
|
|
umlautUtf8ToInt = &HC3A6
|
|
Case "é"
|
|
umlautUtf8ToInt = &HC3A9
|
|
Case "Ù"
|
|
umlautUtf8ToInt = &HC399
|
|
Case "ù"
|
|
umlautUtf8ToInt = &HC3B9
|
|
Case "Ü"
|
|
umlautUtf8ToInt = &HC39C
|
|
Case "è"
|
|
umlautUtf8ToInt = &HC3A8
|
|
Case Else
|
|
MsgBox ("unknown character: " & c)
|
|
End Select
|
|
|
|
End Function
|
|
|
|
Private Sub umlaut_test()
|
|
Dim c As String
|
|
Dim i As Integer
|
|
c = "ä"
|
|
i = umlautUtf8ToInt(c)
|
|
MsgBox (c & " = " & i & " = " & Hex(i))
|
|
End Sub
|
|
|