Scintilla and string in unicode problem

Just starting out? Need help? Post your questions and find answers here.
mag
Enthusiast
Enthusiast
Posts: 104
Joined: Mon Mar 29, 2004 1:46 pm

Scintilla and string in unicode problem

Post by mag »

Do we have a purebasic setting to treat all string as ASCII not unicode?

I have a bit of a problem to exchange data between PB and Scintilla
infratec
Always Here
Always Here
Posts: 7712
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Scintilla and string in unicode problem

Post by infratec »

No.

Only if you use an old version of PB :wink:

But you can always use UTF8() or ASCII() o convert the unicode string from PB.
AZJIO
Addict
Addict
Posts: 2241
Joined: Sun May 14, 2017 1:48 am

Re: Scintilla and string in unicode problem

Post by AZJIO »

Switching encoding

Code: Select all

ScintillaSendMessage(#SciGadget, #SCI_SETCODEPAGE, #SC_CHARSET_ANSI)
ScintillaSendMessage(#SciGadget, #SCI_STYLESETCHARACTERSET, 0, #SC_CHARSET_CYRILLIC)
conversion to another encoding

Code: Select all

*Buffer = UTF8(PeekS(*mem, -1, #PB_Ascii))
*Buffer = Ascii(PeekS(*mem, -1, #PB_UTF8))

Import "user32.lib"
; 	OemToCharBuffA(*Buff,*Buff1,SizeBuff)
	CharToOemBuffA(*Buff,*Buff1,SizeBuff)
EndImport
CharToOemBuffA(*Buffer, *Buffer, txtLen)
My_Notepad_Sci
mag
Enthusiast
Enthusiast
Posts: 104
Joined: Mon Mar 29, 2004 1:46 pm

Re: Scintilla and string in unicode problem

Post by mag »

Thank you @infratec and @AZJIO
Post Reply