Good morning
How am I supposed to save UTF8/16 strings on SQLBASE 11.7.3 and 12.1?
I couldn't find any info about character sets outside some references to codepages.
Should I use NVARCHAR instead of VARCHAR? It doesn't seem to work.
Any suggestion is much appreciated
Inserting UTF-16 characters (native,ODBC,JDBC)
-
- Site Admin
- Posts: 430
- Joined: 05 Mar 2017, 20:57
- Location: Stroud, England <--> Tauranga, New Zealand
Re: Inserting UTF-16 characters (native,ODBC,JDBC)
.
Have you declared the column you are saving to as nvarchar or varchar ?
Does your inserted string look something like this '〱䔠楤扮牵桧䰠湡e'
If so, convert your multi-byte string to a unicode string using SalStrToWideChar(). This works for me regardless of how the column is declared:
What does this mean ? You need to be more specific.It doesn't seem to work
Have you declared the column you are saving to as nvarchar or varchar ?
Does your inserted string look something like this '〱䔠楤扮牵桧䰠湡e'
If so, convert your multi-byte string to a unicode string using SalStrToWideChar(). This works for me regardless of how the column is declared:
Code: Select all
Call SalStrToWideChar(sIn,sOut,ENC_UTF8)
If SqlPrepareAndExecute( hSql, 'Update COMPANY set address = :sOut, address_n = :sOut where company_id = 101' )
Call SqlCommit(hSql)
Greetings from New Zealand
Steve Leighton
Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand
www.banksidesystems.co.uk
Steve Leighton
Bankside Systems Ltd.
UK ♦ Australia ♦ New Zealand
www.banksidesystems.co.uk
Re: Inserting UTF-16 characters (native,ODBC,JDBC)
I've made some progress
result: M
result: Miękina
Only the nvarchar column works, and ONLY with bind variables: doesn't work
Code: Select all
CREATE TABLE TEST (
COL VARCHAR(100),
COL2 NVARCHAR(100)
);
Code: Select all
On SAM_AppStartup
Set sName = 'Miękina'
Call SalStrToWideChar( sName, sNameWide, ENC_UTF8)
If SqlConnectEx( hSql, 'MYDB', 'SYSADM', 'SYSADM' )
If SqlPrepareAndExecute(hSql, "insert into TEST values( :sNameWide, :sName )")
If SqlCommit(hSql)
Call SqlDisconnect(hSql)
result: Miękina
Only the nvarchar column works, and ONLY with bind variables:
Code: Select all
insert into TEST values('Miękina','Miękina')
Who is online
Users browsing this forum: [Ccbot] and 1 guest