Issue when CASTING a field as ASCII
Posted by: Sébastien Arnaud
Date: March 01, 2007 03:53PM

Hi,

I wrote a function that converts ASCII encoded UTF8 strings into XML ascii decimal entities, but I am having troubles when trying to use it on a DB field.

Here is how it works:

SELECT fn_utf2lat2xml_v2(_ascii'Отрицательный отзыв ');

RETURNS:

#1054;трицательный отзыв

Now, I am trying to use it in a simple query:

SELECT @test := 'Отрицательный отзыв ';

SELECT odata.fn_utf2lat2xml_v2(CAST(@test AS CHAR CHARACTER SET ascii) COLLATE ascii_general_ci);

But it returns then:
?????????????????????????? ??????????

If I add '_ascii' initially though it works:
SELECT @test := _ascii'Отрицательный отзыв ';
SELECT odata.fn_utf2lat2xml_v2(CAST(@test AS CHAR CHARACTER SET ascii) COLLATE ascii_general_ci);

Returns:
Отрицательный отзыв

So my question is the following: Is there a way to convert a local variable, string or field to perform the equivalent of _ascii'mystring' ? I tried CAST, CONVERT with no luck.

FYI, the function I wrote expects a ASCII encoded string, but somehow right now I am failing to provide this properly without the use of _ascii.

Thank you in advance for your help!

Sébastien

Options: ReplyQuote


Subject
Views
Written By
Posted
Issue when CASTING a field as ASCII
6314
March 01, 2007 03:53PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.