| |
|
|
| Ansi Utf16 Utf8 Widechar ansi2wide utf82wide wide2utf8 wide2ansi chrw ordw KompilierenMarkierenSeparieren// Ersatzfunktion für das native, derzeit fehlerhafte char$
nProc _char(long hMem,from,length){
case length<1 : return ""
string s=space(length)
rtlMoveMemory(s,hMem+from,length)
return s
}
ansiTowide(string text){//von Nico Madysa, nichtnativ
declare b#
Dim b#,2*len(text)+2
StringW b#,0 = text
text = Char$(b#,0,SizeOf(b#)-2)
return text
}
nProc ansi2Wide(string s){
s=s+"\z\z"
long cc=len(s)*2
long buff=dim(cc)
long c=multiByteToWideChar(CP_ACP,,addr(s),-1,buff,cc)
s=""
case c>null : s=_char(buff,,c*2-2)
dispose(buff)
return s
}
nProc utf82wide(string s){
s=s+"\z\z"
long cc=len(s)*2
long buff=dim(cc)
long c=multiByteToWideChar(CP_UTF8,0,addr(s),-1,buff,cc)
s=""
case c>0 : s=_char(buff,0,c*2-2)
dispose(buff)
return s
}
nProc wide2utf8(string s){
s=s+"\z\z"
long buff=dim(len(s))
long c=wideCharToMultiByte(CP_UTF8,0,addr(s),-1,buff,len(s),0,0)
s=""
case c>1 : s=_char(buff,0,c-1)
dispose(buff)
return s
}
nProc wide2ansi(string s){
s=s+"\z\z"
long buff=dim(len(s))
long c=wideCharToMultiByte(CP_ACP,0,addr(s),-1,buff,len(s),0,0)
s=""
case c>1 : s=_char(buff,0,c-1)
dispose(buff)
return s
}
nproc chrw(long wc){
long m=dim(2)
word m&,0=wc
string s=_char(m,0,2)
dispose(m)
return s
}
nproc ordw(string s){
long m=dim(2)
char m&,0=left$(s$+"\z\z",2)
long wc=word(m,0)
dispose(m)
return href='./../../funktionsreferenzen/xprofan/wc/'>wc
}
|
|
|
| |
|
|
|
| |
|
| |
|
|
|
| erweitert um ordw (Dank an Nico) |
|
|
| |
|
|
|
Nico Madysa | Native Variante von AnsiToWide hinzugefügt. Außerdem statt char$() (derzeit in nProcs fehlerhaft implementiert) Ersatzfunktion _char() verwendet. |
|
|
| |
|
|