<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:right;
        direction:rtl;
        unicode-bidi:embed;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1 dir=RTL>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Hello,<o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I'm
working on a module to auto translate nodes on my websites. I'm using google
translate to do this.<o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I've
encountered a problem that I was hoping someone would have an idea how to solve&#8230;.when
I translate a text that has &quot;special characters&quot;, mainly those that aren&#8217;t
English, and I try to display them, I get characters that are black diamonds. When
trying to display those using drupal with drupal set message, something strange
happens, it seems like drupal just ignores the entire function. I'm trying to
print it out of a nodeapi hook, and the when I do all the other
drupal_set_messages aren&#8217;t displayed, even those that come before. <o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Anyway,
I think I've isolated the problem to the encoding of the characters, but I
don't know how to solve it. I see the characters with the black diamonds when I
print_r($translation), in this case I only see them. And when ever I try to drupal_set_message
them I don't see anything. <o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>If
I translate a text that doesn't have one of those characters, all is well.<o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>This
is what I'm using to translate the texts:<o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>function
google_translate($text, $from = 'en', $to = 'es') {</span></font><font size=2
face=Arial><span lang=HE dir=RTL style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><span dir=LTR></span><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'><span dir=LTR></span>&nbsp; $data = &quot;h1=en&amp;ie=UTF8&amp;text=$text&quot;;</span></font><font
size=2 face=Arial><span lang=HE dir=RTL style='font-size:10.0pt;font-family:
Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><span dir=LTR></span><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'><span dir=LTR></span>&nbsp; $result = drupal_http_request(I18N_AUTO_GOOGLE_TRANSLATE_TRANSLATOR_URL
. '?langpair='. $from .'|'. $to, array(), 'POST', $data);</span></font><font
size=2 face=Arial><span lang=HE dir=RTL style='font-size:10.0pt;font-family:
Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><span dir=LTR></span><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'><span dir=LTR></span>&nbsp; $texttosearch = &quot;id=result_box&quot;;</span></font><font
size=2 face=Arial><span lang=HE dir=RTL style='font-size:10.0pt;font-family:
Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><span dir=LTR></span><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'><span dir=LTR></span>&nbsp; $start = strpos($result-&gt;data,
$texttosearch);</span></font><font size=2 face=Arial><span lang=HE dir=RTL
style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><span dir=LTR></span><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'><span dir=LTR></span>&nbsp; $end = strpos($result-&gt;data,
&quot;&lt;/div&gt;&quot;, $start+24);</span></font><font size=2 face=Arial><span
lang=HE dir=RTL style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><span dir=LTR></span><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'><span dir=LTR></span>&nbsp; $start = $start + 24;</span></font><font
size=2 face=Arial><span lang=HE dir=RTL style='font-size:10.0pt;font-family:
Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><span dir=LTR></span><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'><span dir=LTR></span>&nbsp; $translated = substr($result-&gt;data,
$start, $end-$start);</span></font><font size=2 face=Arial><span lang=HE
dir=RTL style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><span dir=LTR></span><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'><span dir=LTR></span>&nbsp; return $translated;<o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>}<o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Thanks<o:p></o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal dir=LTR style='text-align:left;direction:ltr;unicode-bidi:
embed'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>Idan<o:p></o:p></span></font></p>

</div>

</body>

</html>