cancel
Showing results for 
Search instead for 
Did you mean: 

UTF8 conversion

Former Member
4,466

Is there any way to convert some column from iso to utf8?

Something like... SELECT Id, UTF8(Name FROM table;

I need because JSON issue, i need to convert it in PHP using utf8 funcions... I'd like to receive the data already converted.

Accepted Solutions (0)

Answers (2)

Answers (2)

johnsmirnios
Advisor
Advisor

Also consider casting the column to NCHAR using TO_NCHAR( col ) or CAST( col as NCHAR ). You can also then manipulate the string as UTF8 within the database server itself as needed. I'm expecting (though I haven't tried it) that JSON will do "the right thing" with NCHAR values.

-john.

MarkCulp
Participant

Vincent has pointed you in the right direction in his comment to your question.

If you want to convert your data from database character to UTF8 then using

set @utf8_data = csconvert( @your_db_char_data, 'utf8' );

will convert @your_db_char_data from the database character set to UTF8.

For more information on the csconvert function see http://dcx.sybase.com/index.html#1101en/dbreference_en11/csconvert-alphabetical-functions.html

Breck_Carter
Participant

Soooo... if you like a comment, vote it up: hover over the comment and you will see a teeny clickable arror.

Breck_Carter
Participant
0 Kudos

...not THIS comment, Vincent Buck's comment 🙂