Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

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.5k5417271050

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
12.0k396166
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
25.0k10142298
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: 4,078 times

last updated: 01 Apr '10, 15:28