Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling google translate from PLSQL using HTTPURITYPE

Narender KoosukuntlaJan 16 2014 — edited Jan 16 2014

Hi All,

I am calling Google Translate URL from a Select query as below. This is to convert from English to Vietnamese.

SELECT REGEXP_SUBSTR(tr,'<span id=result_box class="short_text"><span[^>]*>(.*)</span></span>',1,1,'i',1) translated_value

FROM (SELECT httpuritype('http://translate.google.com/?hl=en&layout=1&eotf=1&sl=en&tl='||'vi'||'&text='|| UTL_URL.escape('My text to be converted')|| '#').getclob() tr

         FROM DUAL);

The expected result is: (Checked on google.com/translate from web and in the page source the charset was UTF-8)

Văn bản của tôi được chuyển đổi

What I got it is: (Checked the clob returned by httpuritype and the charset was ISO-8859-1)

V&#259;n b&#7843;n c&#7911;a tôi &#273;&#432;&#7907;c chuy&#7875;n &#273;&#7893;

Please, any help on getting the expected result

Regards,

Narender

This post has been answered by odie_63 on Jan 16 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 13 2014
Added on Jan 16 2014
7 comments
1,394 views