The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

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
26.6k418575824

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
8.7k377106
accept rate: 40%

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
22.3k9129262
accept rate: 40%

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:

×13
×10
×2
×1

question asked: 31 Mar '10, 20:59

question was seen: 1,805 times

last updated: 01 Apr '10, 15:28