<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:m="http://schemas.microsoft.com/office/2004/12/omml" 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)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@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;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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="WordSection1">
<p class="MsoNormal">msyytext/msyystring&nbsp;isn’t being truncated per se it’s just that a string with spaces is not valid in a mapfile. That is:<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">&nbsp; TEXT Sample Text<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">would normally generate a parsing error. In this case only the string Sample Text is being parsed and without the quotes only the text ahead of the space is matched. I suppose it’s possible to relax the string matching expression in maplexer.l
 when in EXPRESSION_STRING context to allow spaces and other characters.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Steve<span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;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:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Tamas Szekeres [mailto:szekerest@gmail.com]
<br>
<b>Sent:</b> Wednesday, February 22, 2012 9:14 AM<br>
<b>To:</b> Lime, Steve D (DNR)<br>
<b>Cc:</b> mapserver-dev@lists.osgeo.org<br>
<b>Subject:</b> Re: [mapserver-dev] classObj.setText, text must be quoted<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Checking the first character instead of the length would be a good solution for MapServer 6.0 and the earlier versions. But I'm not sure how this would solve the same problem in trunk. Actually when getSymbol is failing we can obtain only
 a truncated text from msyytext/msyystring so we cannot use this to assign the value to the corresponding property. We should probably find out the reason why&nbsp; msyytext/msyystring&nbsp;is truncated in this case or use the &quot;value&quot; argument of loadExpressionString
 instead.&nbsp;Does this make sense?<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Best regards,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Tamas<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">2012/2/22 Lime, Steve D (DNR) &lt;<a href="mailto:Steve.Lime@state.mn.us">Steve.Lime@state.mn.us</a>&gt;<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black">In 6.0 class-&gt;text is a true expressionObj, not a string as in previous versions so at least via SWIG setText() calls msLoadExpressionString().
 I think there could be a bug in that function at line 2169 (in trunk). Older versions of that function treat the input string as a the expression if parsing doesn't detect a delimited type. So does this version but in a different way:<br>
<br>
// trunk<br>
&nbsp;&nbsp;&nbsp; exp-&gt;type = MS_STRING;<br>
&nbsp;&nbsp;&nbsp; exp-&gt;string = msStrdup(msyystring_buffer);<br>
<br>
// 5.6 branch<br>
&nbsp;&nbsp;&nbsp; exp-&gt;type = MS_STRING;<br>
&nbsp;&nbsp;&nbsp; if((strlen(value) - strlen(msyytext)) == 2)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exp-&gt;string = strdup(msyytext); /* value was quoted */<br>
&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exp-&gt;string = strdup(value); /* use the whole value */<br>
<br>
I've got a feeling this has to do with escaping quotes where msyystring_buffer contains the escaped text. Perhaps we could do something like:<br>
<br>
&nbsp;&nbsp;&nbsp; exp-&gt;type = MS_STRING;<br>
&nbsp;&nbsp;&nbsp; if(... if first char in value is not a single or double quote ...)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exp-&gt;string = strdup(value);&nbsp; /* use the whole value */<br>
&nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exp-&gt;string = msStrdup(msyystring_buffer);<br>
<br>
Alan, does this make sense or is there another way to know that escaping was processed?<br>
<br>
Steve<o:p></o:p></span></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="color:black">
<hr size="2" width="100%" align="center">
</span></div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black">From:</span></b><span style="font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:black">
<a href="mailto:mapserver-dev-bounces@lists.osgeo.org" target="_blank">mapserver-dev-bounces@lists.osgeo.org</a> [<a href="mailto:mapserver-dev-bounces@lists.osgeo.org" target="_blank">mapserver-dev-bounces@lists.osgeo.org</a>] on behalf of Tamas Szekeres [<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>]<br>
<b>Sent:</b> Tuesday, February 21, 2012 4:09 PM<br>
<b>To:</b> <a href="mailto:mapserver-dev@lists.osgeo.org" target="_blank">mapserver-dev@lists.osgeo.org</a><br>
<b>Subject:</b> [mapserver-dev] classObj.setText, text must be quoted</span><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="color:black">Hi Devs, <o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">By using the following mapscript example:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="color:black">&nbsp; &nbsp; &nbsp;<i>// creating a new map from scratch</i><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp; &nbsp; &nbsp; mapObj map = new mapObj(null);</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp; &nbsp; &nbsp; // adding a layer</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp; &nbsp; &nbsp; layerObj layer = new layerObj(map);</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp; &nbsp; &nbsp; // define the class</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp; &nbsp; &nbsp; classObj classobj = new classObj(layer);</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp;classobj.setText(&quot;Sample Text&quot;);</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Sample Text -&gt; &quot; &#43; classobj.getTextString());</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp;classobj.setText(&quot;Sample T&quot;);</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Sample T -&gt; &quot; &#43; classobj.getTextString());</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp;classobj.setText(&quot;\&quot;Sample T\&quot;&quot;);</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><i><span style="color:black">&nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;\&quot;Sample T\&quot; -&gt; &quot; &#43; classobj.getTextString());</span></i><span style="color:black"><o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">I got the following output (from trunk):<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="color:black">Sample Text -&gt; &quot;Sample Text&quot;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Sample T -&gt; &quot;Sample&quot;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">&quot;Sample T&quot; -&gt; &quot;Sample T&quot;<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">6.0 branch produces this:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="color:black">Sample Text -&gt; &quot;Sample&quot;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Sample T -&gt; &quot;Sample&quot;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">&quot;Sample T&quot; -&gt; &quot;Sample T&quot;<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Do we have a requirement that the texts must be quoted which is passed to&nbsp;<i>classobj.setText?</i><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Best regards,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Tamas<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black"><o:p>&nbsp;</o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
</body>
</html>