hi all,
can somebody explain me what is happening here???
(french keyboard, french winxp sp3, french accents)
(http://img694.imageshack.us/img694/6905/sanstitre2ylw.jpg)
def i : int
i=asc("a")
print "a"," ", i, " ",chr$(i)
i=asc("e")
print "e"," ", i, " ",chr$(i)
i=asc("u")
print "u"," ", i, " ",chr$(i)
print "-----------"
i=asc("à")
print "à"," ", i, " ",chr$(i)
i=asc("é")
print "é"," ", i, " ",chr$(i)
i=asc("ù")
print "ù"," ", i, " ",chr$(i)
do:until inkey$<>""
closeconsole
end
hi philippe.tx, i beleive this has something to do with the character set (i.e. font table) used. The default console font is SYSTEM, but the default font for the CB editor is something else (I think it's Courier New). the ASCII set is only the same for characters up to 255, anything above this is different depending on the character set used (and is in fact not part of the ASCII standard anymore).
I had excatly the same problem with a norwegian language setup. It happened only when trying to print norwegian text in console programs.
Here is a solution I found on the HotBasic forum, and converted to CB. It should work with your system as well.
Regards
Egil
' ConvToOEM.bas
'
DECLARE "user32.dll",CharToOem Alias CharToOemA(lpszSrc:STRING,lpszDst:STRING),INT
Declare ConvToOEM(txt:string)
' --- Test program ---------------------------
openconsole
def tmp1,tmp2:string
tmp1 = "Norwegian characters: æøå ÆØÅ"
print tmp1
print
tmp2 = ConvToOEM(tmp1)
print tmp2
do:until inkey$ <>""
closeconsole
end
'---------------------------------------------
SUB ConvToOEM(txt:string)
def org,ret:string
org = txt
ret = STRING$(len(org), chr$(0))
CharToOem(org,ret)
RETURN ret
many many thanks :)