<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="&#1;" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Mangal;
        panose-1:0 0 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Mangal;
        panose-1:0 0 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

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

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hi<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>As per the code documentation in the method </span><span
style='font-size:10.0pt;font-family:"Courier New"'>msGetEncodedString (as shown
below</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>), the characters are assumed to be UTF-8 by default.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:blue'>char</span><span style='font-size:10.0pt;
font-family:"Courier New"'> *msGetEncodedString(<span style='color:blue'>const</span>
<span style='color:blue'>char</span> *string, <span style='color:blue'>const</span>
<span style='color:blue'>char</span> *encoding)<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>{<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>---<o:p></o:p></span></p>

<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>  <span style='color:blue'>if</span> (len == 0 ||
(encoding &amp;&amp; strcasecmp(encoding, <span style='color:#A31515'>&quot;UTF-8&quot;</span>)==0))<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>     
<span style='color:blue'>return</span> strdup(string);    <span
style='color:green'>/* Nothing to do: string already in UTF-8 */<o:p></o:p></span></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:green'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Where as in the ‘values’ property of shapeObj.cs in C#, it is
using System.Runtime.InteropServices.Marshal.PtrToStringAnsi  (to marshal characters
from c to c#). Shoudn’t it be using System.Runtime.InteropServices.Marshal.PtrToStringUni
method since as the charcters are by default held in UTF-8 encoding?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Murty<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Tamas Szekeres
[mailto:szekerest@gmail.com] <br>
<b>Sent:</b> Wednesday, March 04, 2009 5:25 PM<br>
<b>To:</b> Murty Maganti<br>
<b>Cc:</b> mapserver-users@lists.osgeo.org<br>
<b>Subject:</b> Re: [mapserver-users] Encoding issues<o:p></o:p></span></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'>Hi,<br>
<br>
I don't know much about the hindi character sets.<br>
I guess you could extent that byte array to string copy function with arbitrary
character sizes, like for double bytes something like:<br>
<br>
for (int i = 0; i &lt; bytes.Length; i=i+2)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
s.Append(Convert.ToChar(bytes[i] + 256*bytes[i+1]));<br>
<br>
Best regards,<br>
<br>
Tamas<br>
<br>
<br>
<o:p></o:p></p>

<div>

<p class=MsoNormal>2009/3/4 Murty Maganti &lt;<a
href="mailto:MMaganti@oriongis.com">MMaganti@oriongis.com</a>&gt;<o:p></o:p></p>

<div>

<div>

<p><span style='font-size:11.0pt;color:#1F497D'>Hi Tamas </span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>This is still not working for
some of the Asian languages. </span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>I suspect the issue could be in
this line of your sample code below</span><o:p></o:p></p>

<div>

<p>s.Append(Convert.ToChar(bytes[i])); <o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

</div>

<p><span style='font-size:11.0pt;color:#1F497D'>Here, one single byte is
used&nbsp; to convert to a character. But my understanding is that UTF-8 can
consume from 1 to 4 bytes to represent one character code point. It worked fine
for Arabic may be because all Arabic characters can be represented using a
single byte. </span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>When I tried the same code
below with Hindi, an Indian language, some of the characters are shown junk
(but not all characters). I guess those characters which occupy more than a
byte turned out to be junk.</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>I am also trying the opposite
of the sample code below i.e. read a field value from map server
(shapeObj.values), which is in Hindi, and show on a web page, again it turns
out to be junk. I tried to look at the byte values of the string in VS by using
</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Byte[] bites =
Encoding.Unicode.GetBytes(shapeObj.values[0])</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>I notice that they are actually
code point of UTF-8 but interpreted as UTF-16 and may be the reason I see junk
characters on web page. But I don’t know how to extract those UTF-8 byte values
from UTF-16.</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>I am just giving sample code
here to explain</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:blue'>byte</span>[] utf16 = <span style='color:#2B91AF'>Encoding</span>.Unicode.GetBytes(<span
style='color:#A31515'>&quot;</span></span><span lang=HI style='font-size:10.0pt;
font-family:Mangal;color:#A31515'>कीचनर</span><span style='font-size:10.0pt;
font-family:"Courier New";color:#A31515'>&quot;</span><span style='font-size:
10.0pt;font-family:"Courier New"'>); //The text is in Hindi, an Indian language</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:blue'>byte</span>[] utf8 = <span style='color:#2B91AF'>Encoding</span>.UTF8.GetBytes(<span
style='color:#A31515'>&quot;</span></span><span lang=HI style='font-size:10.0pt;
font-family:Mangal;color:#A31515'>कीचनर</span><span style='font-size:10.0pt;
font-family:"Courier New";color:#A31515'>&quot;</span><span style='font-size:
10.0pt;font-family:"Courier New"'>);</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:#2B91AF'>shapeObj</span> shape =
layer.getFeature(result.shapeindex, result.tileindex);</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:blue'>string</span> value = shape.values[1]; //This contains
the same text (in Hindi) as above in the shape file.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:blue'>byte</span>[] bytes = <span style='color:#2B91AF'>Encoding</span>.Unicode.GetBytes(value);
//There are byte values of characters decoded from UTF-16. .Net internally
stores all strings in UTF-16 </span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Now if I examine the values of
‘utf8’ and ‘bytes’ arrays</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>utf8 –
224,164,149,224,165,128,224,164,154,224,164,168,224,164,176</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>bytes – <b>224</b>,0,<b>164</b>,0,34,32,<b>224</b>,0,<b>165</b>,0,172,32,<b>224</b>,0,<b>164</b>,0,97,1,<b>224</b>,0,<b>164</b>,0,<b>168</b>,0,<b>224</b>,0,<b>164</b>,0,<b>176</b>,0</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>utf16 –
21,9,64,9,26,9,40,9,48,9</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>The first byte value is same as
UTF-8. Second byte value is 0 as UTF-16 takes atleast 2 bytes for a character.
This gives me impression that the byte values are in UTF-8 and are not
converted to UTF-16 to by .Net.</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Appreciate if you see any
solution for this and let me know. </span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Thanks</span><o:p></o:p></p>

<p style='margin-bottom:12.0pt'><span style='font-size:11.0pt;color:#1F497D'>Murty</span><o:p></o:p></p>

<div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color -moz-use-text-color'>

<p><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:
10.0pt'> Tamas Szekeres [mailto:<a href="mailto:szekerest@gmail.com"
target="_blank">szekerest@gmail.com</a>] <br>
<b>Sent:</b> Friday, February 06, 2009 6:59 PM<o:p></o:p></span></p>

<div>

<div>

<p class=MsoNormal><span style='font-size:10.0pt'><br>
<b>To:</b> Murty Maganti<br>
<b>Cc:</b> <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b>Subject:</b> Re: [mapserver-users] Encoding issues<o:p></o:p></span></p>

</div>

</div>

</div>

<div>

<div>

<p>&nbsp;<o:p></o:p></p>

<p style='margin-bottom:12.0pt'>You might have to make explicit conversion maually
something like:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string value
= &quot;<span lang=AR-SA dir=RTL>لققافعععىىةةونه</span><span dir=LTR></span><span
dir=LTR></span><span dir=LTR></span><span dir=LTR></span>&quot;; //I actually
get this (in arabic) through user input<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] bytes
= Encoding.Convert(Encoding.Unicode, Encoding.GetEncoding(1256),
Encoding.Unicode.GetBytes(value));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
StringBuilder s = new StringBuilder();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i =
0; i &lt; bytes.Length; i++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
s.Append(Convert.ToChar(bytes[i]));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shpObj.text
= s.ToString();<br>
<br>
Best regards,<br>
<br>
Tamas<br>
<br>
<o:p></o:p></p>

<div>

<p>2009/2/6 Murty Maganti &lt;<a href="mailto:MMaganti@oriongis.com"
target="_blank">MMaganti@oriongis.com</a>&gt;<o:p></o:p></p>

<div>

<div>

<p><span style='font-size:11.0pt;color:#1F497D'>HI </span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>I am doing a simple thing. I
have a map file and trying to show some static text in Arabic on map. You can
try this with any map file as it is nothing to do with layers from map.</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>At run time (like on a button
click), please add this</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:#2B91AF'>layerObj</span> lyr = <span style='color:blue'>new</span>
<span style='color:#2B91AF'>layerObj</span>(mapObj);</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="http://lyr.name" target="_blank">lyr.name</a> = <span
style='color:#A31515'>&quot;TextAcetate&quot;</span>;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
lyr.status = <span style='color:#2B91AF'>mapscript</span>.MS_ON;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
lyr.type = <span style='color:#2B91AF'>MS_LAYER_TYPE</span>.MS_LAYER_ANNOTATION;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
lyr.labelcache = <span style='color:#2B91AF'>mapscript</span>.MS_TRUE;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:blue'>double</span> locationX = 50;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:blue'>double</span> locationY = 50;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Courier New"'>lyr.transform = (<span style='color:blue'>int</span>)<span
style='color:#2B91AF'>mapscript</span>.MS_FALSE;</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Courier New";color:#2B91AF'>classObj</span><span style='font-size:
10.0pt;font-family:"Courier New"'> layerClass = <span style='color:blue'>new</span>
<span style='color:#2B91AF'>classObj</span>(lyr);</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:11.0pt;
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:11.0pt;
color:#1F497D'>//All label properties</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Courier New"'>layerClass.label.size = 15;</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Courier New"'>layerClass.label.type =<span style='color:#2B91AF'>
MS_FONT_TYPE</span>.MS_TRUETYPE;</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Courier New"'>…</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Courier New"'>…</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Courier New"'>layerClass.label.encoding = &quot;CP1256&quot;;</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p style='margin-left:1.0in;text-indent:.5in'><span style='font-size:11.0pt;
color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:#2B91AF'>shapeObj</span> shpObj = <span style='color:blue'>new</span>
<span style='color:#2B91AF'>shapeObj</span>((<span style='color:blue'>int</span>)<span
style='color:#2B91AF'>MS_SHAPE_TYPE</span>.MS_SHAPE_POINT);</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:#2B91AF'>lineObj</span> lnObj = <span style='color:blue'>new</span>
<span style='color:#2B91AF'>lineObj</span>();</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:#2B91AF'>pointObj</span> pt = <span style='color:blue'>new</span>
<span style='color:#2B91AF'>pointObj</span>(locationX, locationY, 0, 0);</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
lnObj.add(pt);</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
shpObj.add(lnObj);</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
shpObj.text = &quot;</span><span lang=AR-AE dir=RTL style='font-size:10.0pt;
font-family:"Courier New"'>لققافعععىىةةونه</span><span dir=LTR></span><span
dir=LTR></span><span style='font-size:10.0pt;font-family:"Courier New"'><span
dir=LTR></span><span dir=LTR></span>&quot;; //I actually get this (in arabic)
through user input</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
lyr.addFeature(shpObj);</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>mapObj.draw();
//Onto a picture box or save as file</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>(In the map file, my output
format is set to GD/PNG)</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Please let me know if you need
more information.</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Thanks</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Murty</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color'>

<p><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:
10.0pt'> <a href="mailto:mapserver-users-bounces@lists.osgeo.org"
target="_blank">mapserver-users-bounces@lists.osgeo.org</a> [mailto:<a
href="mailto:mapserver-users-bounces@lists.osgeo.org" target="_blank">mapserver-users-bounces@lists.osgeo.org</a>]
<b>On Behalf Of </b>Tamas Szekeres<br>
<b>Sent:</b> Friday, February 06, 2009 4:12 PM</span><o:p></o:p></p>

<div>

<div>

<p><span style='font-size:10.0pt'><br>
<b>To:</b> Murty Maganti<br>
<b>Cc:</b> <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b>Subject:</b> Re: [mapserver-users] Encoding issues</span><o:p></o:p></p>

</div>

</div>

</div>

<div>

<div>

<p>&nbsp;<o:p></o:p></p>

<p style='margin-bottom:12.0pt'>Please send me your example so that I could
examine what's going on.<br>
<br>
Best regards,<br>
<br>
Tamas<o:p></o:p></p>

<div>

<p>2009/2/6 Murty Maganti &lt;<a href="mailto:MMaganti@oriongis.com"
target="_blank">MMaganti@oriongis.com</a>&gt;<o:p></o:p></p>

<div>

<div>

<p><span style='font-size:11.0pt;color:#1F497D'>Hi</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>I tried with the suggested encoding
but still no success.</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>From the output below, I guess
ICONV support is included.</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>E:\Utils\MapServer\Map Server
5.2 RC\ms4w\Apache\cgi-bin&gt;mapserv -v</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>MapServer version 5.2.0
OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;OUTPUT=SWF OUTPUT=SVG
SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE <b>SUPPORTS=ICO</b></span><o:p></o:p></p>

<p><b><span style='font-size:11.0pt;color:#1F497D'>NV</span></b><span
style='font-size:11.0pt;color:#1F497D'> SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>SUPPORTS=WFS_CLIENT
SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUP</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>PORTS=THREADS SUPPORTS=GEOS
SUPPORTS=RGBA_PNG INPUT=JPEG INPUT=POSTGIS INPUT=OGR</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;INPUT=GDAL
INPUT=SHAPEFILE</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Where can get some details on
how to build the C# mapscript (Managed assembly only) from Visual Studio,
keeping all unmanaged dlls from binaries from ms4w. I just want to give a try
using MarshalAsAttribute.</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>&nbsp;</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Thanks</span><o:p></o:p></p>

<p><span style='font-size:11.0pt;color:#1F497D'>Murty</span><o:p></o:p></p>

<div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;
border-color:-moz-use-text-color'>

<p><b><span style='font-size:10.0pt'>From:</span></b><span style='font-size:
10.0pt'> Tamas Szekeres [mailto:<a href="mailto:szekerest@gmail.com"
target="_blank">szekerest@gmail.com</a>] <br>
<b>Sent:</b> Friday, February 06, 2009 3:02 PM<br>
<b>To:</b> Murty Maganti<br>
<b>Cc:</b> <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b>Subject:</b> Re: [mapserver-users] Encoding issues</span><o:p></o:p></p>

</div>

<div>

<div>

<p>&nbsp;<o:p></o:p></p>

<p style='margin-bottom:12.0pt'>Hi,<br>
<br>
You might want to try with encoding=&quot;ISO-8859-6&quot; assuming you have
libiconv compiled in.<br>
The c# mapscript doesn't specify explicit conversion during the marshaling. In
this case I assume an unicode to Charset.Ansi conversion will automatically
takes place by default.<br>
<br>
Best regards,<br>
<br>
Tamas<br>
<br>
<o:p></o:p></p>

<div>

<p>2009/2/6 Murty Maganti &lt;<a href="mailto:MMaganti@oriongis.com"
target="_blank">MMaganti@oriongis.com</a>&gt;<o:p></o:p></p>

<div>

<div>

<p>Hello <o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>I am having some issues using Arabic text as labels. I am using C# map
script. I am setting the following at runtime<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>labelObj label = classObj.label;<o:p></o:p></p>

<p>label.encoding = &quot;CP1256&quot;;<o:p></o:p></p>

<p>label.text = &quot;some text in Arabic&quot;; (At rune time in VS, I can see
the text is actually in Arabic)<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>But labels are displayed as '?????'.<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>&nbsp;Is there any conversion I need to do before setting the text value.
How are the string represented in the underlying mapscript dll (ASCII or Unicode?).
As I was reading in the MSDN, the default marshalling uses LPStr which is a
single byte of ASCII. Does it mean that first I need to convert from Unicode to
ASCII in C# before setting the value.<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>Appreciate any help.<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

<p>Thanks<o:p></o:p></p>

<p>Murty<o:p></o:p></p>

<p>&nbsp;<o:p></o:p></p>

</div>

</div>

<p style='margin-bottom:12.0pt'><br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users"
target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><o:p></o:p></p>

</div>

<p>&nbsp;<o:p></o:p></p>

</div>

</div>

</div>

</div>

</div>

<p>&nbsp;<o:p></o:p></p>

</div>

</div>

</div>

</div>

</div>

<p>&nbsp;<o:p></o:p></p>

</div>

</div>

</div>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>