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.

asked 31 Mar '10, 20:59

Ismael's gravatar image

Ismael
2026612
accept rate: 50%

edited 01 Apr '10, 15:28

Breck%20Carter's gravatar image

Breck Carter
32.5k5417261050

3

Did you try CSCONVERT?

(31 Mar '10, 21:17) Vincent Buck

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.

permanent link

answered 01 Apr '10, 15:08

John%20Smirnios's gravatar image

John Smirnios
11.9k396165
accept rate: 37%

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

permanent link

answered 01 Apr '10, 12:06

Mark%20Culp's gravatar image

Mark Culp
24.9k10141297
accept rate: 41%

1

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

(01 Apr '10, 15:29) Breck Carter

...not THIS comment, Vincent Buck's comment :)

(01 Apr '10, 16:50) Breck Carter
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×17
×14
×2
×1

question asked: 31 Mar '10, 20:59

question was seen: 3,878 times

last updated: 01 Apr '10, 15:28