cancel
Showing results for 
Search instead for 
Did you mean: 

How to SET CHARACTER SET UTF8

Former Member
0 Kudos

I am looking to execute something like the stmt "SET CHARACTER SET UTF8"

However if i put the above stmt in a SQLDBC_Statement_execute call, i get fail message.

I should also mention here that, SQLDBC_Connection_connect call provides a way to provide the character set as one of the parameter. Is that the only way we can set character set from an application while using SQLDBC ?

Regards

Raj

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

unfortunatley, MaxDB kernel does not support character set UTF8.

Therefore it is no problem of sqldbc or whatever, it is a missing feature of MaxDB.

May be MaxDB's unicode-handling (parameter _UNICODE, datatype char (..) unicode), stored as UCS/2 will do for your needs?

Elke

Former Member
0 Kudos

Hi Elke,

I am little surprised that you are saying MaxDB doesn't support the character set UTF-8 for unicode. Because the documentation in the link http://maxdb.sap.com/doc/7_6/96/8a9840753d2a54e10000000a1550b0/frameset.htm states that:

Features

SQLDBC provides the following functions, among others:

● Unlimited number of database connections and SQL statements

● Complete Unicode support (UCS2 and UTF-8)

Also like i said earlier there is a way to pass the Encoding type during SQLDBC connection establishment. So, is all this for nothing ?

Regards

Raj

lbreddemann
Active Contributor
0 Kudos

Hi Raja,

please read exactly what Elke wrote:

> It's a missing feature of MaxDB

She refers to the MaxDB Kernel with that.

SQLDBC is designed to be able to handle UTF-8 as soon as the Kernel is ready to support it.

Currently this is not the case, but it will be changed in later releases of MaxDB.

So currently, you won't need to specify the characterset at all the moment.

regards,

Lars

Answers (2)

Answers (2)

Former Member
0 Kudos

Hallo,

CHAR (n) UNICODE in opposit to CHAR (n) ASCII means, that the values in this column are stored in Unicode, in UCS/2, where every character will need 2 bytes.

For ASCII-data stored in such CHAR (n) UNICODE-column it will double the space needed to store the column.

In case the installation-parameter _UNICODE is set to true, you can explicitly create / alter tables specifying CHAR ... UNICODE or VARCHAR ... UNICODE or LONG/LOB UNICODE.

Or you can set the DEFAULT_CODE to UNICODE and every column for which you do NOT specify ASCII/BYTE will become a UNICODE-column.

Elke

TTK
Employee
Employee
0 Kudos

Hello Raja

Although the kernel does not support UTF8 yet, SQLDBC is able to convert from and to UTF8. The encoding type of execution of a statement is given by the type SQLDBC_StringEncodingType, which could represent ASCII, UCS2 and UTF8.

This means, that you can handle UTF8 in your application, but there is no UTF8 semantics in the kernel. Maybe a solution would be, to define character data in your tables as UNICODE and use UTF8 conversion of SQLDBC. Another option could be converting all your application data from UTF8 to UCS2 before SQLDBC sends/receives it to the database.

Regards Thomas

Former Member
0 Kudos

Hi Lars,Elke and Thomas,

Thanks to all of you for your valuable input. Honestly speaking i'm little lost on how to go about this requirement of unicode support for my application. Please allow me some more time to investigate this and then get back to you.

In my application for all other databases a simple execution of "SET CHARACTER SET UTF8" is all that's been done to set the support for UTF-8. So, I really need to figure out what all changes needs to be done in the app if this is not going to work.

In the meantime something more caught my attention while i was using this command:

sqlcli MAXDB1=> \dc domain.columns

Table "DOMAIN.COLUMNS"

Column Name

Type

Length

Nullable

KEYPOS






SCHEMANAME

CHAR UNICODE

32

YES

OWNER

CHAR UNICODE

32

YES

What does the type 'CHAR UNICODE' for Type means here?

Regards

Raj