Hi, I have a database that contains both Japanese and English characters. I'm trying to convert the Japanese charcters into it's Ascii equivalent so that I would have something like "既" instead of the literal japanese charcter; that way when I print it to a browser so that I can simply declare utf-8 and everything will work fine. Here's the code I'm trying so far to get this done.
DECLARE
v_word VARCHAR2(200);
v_len NUMBER;
v_result VARCHAR2(5000);
BEGIN
SELECT Customer_Name
INTO v_word
FROM Contacts
WHERE Language='JA';
v_len := LENGTH(v_word);
FOR i IN 1..v_len LOOP
v_result := v_result || '&#' || ASCII(SUBSTR(v_word,i,1)) || ';';
END LOOP;
dbms_output.put_line(v_result);
END;
This is returning code that, when viewed in the borwser, appears to be half of each word followed by a ?. For example the first ascii code I get back is "�", which if you view through a browser you will see what I mean. I know that japanese is a dual-byte language, but I don't know how to return the correct ascii code for each word. I tried increasing the substring to two charcters in length, but that didn't help either. Does anyone know how to accomplish this?
Thanks.
DECLARE
v_word VARCHAR2(200);
v_len NUMBER;
v_result VARCHAR2(5000);
BEGIN
SELECT Customer_Name
INTO v_word
FROM Contacts
WHERE Language='JA';
v_len := LENGTH(v_word);
FOR i IN 1..v_len LOOP
v_result := v_result || '&#' || ASCII(SUBSTR(v_word,i,1)) || ';';
END LOOP;
dbms_output.put_line(v_result);
END;
This is returning code that, when viewed in the borwser, appears to be half of each word followed by a ?. For example the first ascii code I get back is "�", which if you view through a browser you will see what I mean. I know that japanese is a dual-byte language, but I don't know how to return the correct ascii code for each word. I tried increasing the substring to two charcters in length, but that didn't help either. Does anyone know how to accomplish this?
Thanks.