| Creating Oracle database to support chinese fonts [message #564049] |
Tue, 21 August 2012 01:49  |
 |
abirami.thirunavukkarasu
Messages: 28 Registered: August 2012 Location: Bangalore
|
Junior Member |
|
|
mentioned database is created with Character set = UTF8 and the National Character Set = AL16UTF16 and got the result for other languages (latin,german,french etc) but still Chinese language was not supported.
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET AL16UTF16
I was getting the output as given below-
SQL> select translator ('table and chair','zh-CN','en') English_to_chinese from dual ;
ENGLISH_TO_chinese
--------------------------------------------------------------------------------
┐┐┐┐┐
and the function is given below
/* Formatted on 16/08/2012 21:55:39 (QP5 v5.215.12089.38647) */
CREATE OR REPLACE FUNCTION translator (p_words IN CLOB, -- words to be translated
p_to IN VARCHAR2, -- language to translate to
p_from IN VARCHAR2) -- language to translate from
RETURN CLOB
AS
l_uritype CLOB;
l_result CLOB;
BEGIN
l_uritype :=
httpuritype (
'...://translate.google.com/?hl='
|| p_from
|| '&layout=1&eotf=1&sl='
|| p_from
|| '&tl='
|| p_to
|| '&text='
|| UTL_URL.escape (p_words)
|| '#').getclob ();
l_result :=
REGEXP_SUBSTR (
l_uritype,
'<span id=result_box class="short_text"><span[^>]*>(.*)</span></span>',
1,
1,
'i',
1);
RETURN l_result;
END translator;
/
For this function - I had already registered acl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Creating Oracle database to support chinese fonts [message #564167 is a reply to message #564165] |
Tue, 21 August 2012 14:18   |
 |
Michel Cadot
Messages: 54129 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
So your client character set does not support chinese characters and you got the expected result.
Try the following and post the result:
create table t (c varchar2(10 char));
begin
insert into t
select translator ('table and chair','zh-CN','en') English_to_chinese from dual ;
end;
/
select dump(c) from t;
Regards
Michel
[Updated on: Tue, 21 August 2012 14:30] Report message to a moderator
|
|
|
|
| Re: Creating Oracle database to support chinese fonts [message #564175 is a reply to message #564167] |
Tue, 21 August 2012 21:06   |
 |
abirami.thirunavukkarasu
Messages: 28 Registered: August 2012 Location: Bangalore
|
Junior Member |
|
|
Thanks for the continous support-
Please find the result of the code below-
SQL> begin
2 insert into t
3 select translator ('table and chair','zh-CN','en') English_to_chinese fro
m dual ;
4 end;
5 /
PL/SQL procedure successfully completed.
SQL> select dump(c) from t;
DUMP(C)
--------------------------------------------------------------------------------
Typ=1 Len=10: 215,192,215,211,186,205,210,206,215,211
|
|
|
|
|
|