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 
msyytext/msyystring is truncated in this case or use the &quot;value&quot; argument of loadExpressionString instead. Does this make sense?<div><br></div><div>Best regards,</div><div><br></div><div>Tamas</div><div><br></div>
<div><br><br><div class="gmail_quote">2012/2/22 Lime, Steve D (DNR) <span dir="ltr">&lt;<a href="mailto:Steve.Lime@state.mn.us">Steve.Lime@state.mn.us</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">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&#39;t detect a delimited type. So does this version but in a different way:<br>
<br>
// trunk<br>
    exp-&gt;type = MS_STRING;<br>
    exp-&gt;string = msStrdup(msyystring_buffer);<br>
<br>
// 5.6 branch<br>
    exp-&gt;type = MS_STRING;<br>
    if((strlen(value) - strlen(msyytext)) == 2)<br>
      exp-&gt;string = strdup(msyytext); /* value was quoted */<br>
    else<br>
      exp-&gt;string = strdup(value); /* use the whole value */<br>
<br>
I&#39;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>
    exp-&gt;type = MS_STRING;<br>
    if(... if first char in value is not a single or double quote ...)<br>
        exp-&gt;string = strdup(value);  /* use the whole value */<br>
    else<br>
        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<br>
<br>
<div style="font-family:Times New Roman;color:rgb(0,0,0);font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma"><b>From:</b> <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<br>
</font><br>
</div><div><div></div><div class="h5">
<div></div>
<div>Hi Devs,
<div><br>
</div>
<div>By using the following mapscript example:</div>
<div><br>
</div>
<div>
<div>     <i>// creating a new map from scratch</i></div>
<div><i>      mapObj map = new mapObj(null);</i></div>
<div><i>      // adding a layer</i></div>
<div><i>      layerObj layer = new layerObj(map);</i></div>
<div><i>      // define the class</i></div>
<div><i>      classObj classobj = new classObj(layer);</i></div>
<div><i><span style="white-space:pre-wrap"></span> classobj.setText(&quot;Sample Text&quot;);</i></div>
<div><i>      Console.WriteLine(&quot;Sample Text -&gt; &quot; + classobj.getTextString());</i></div>
<div><i><span style="white-space:pre-wrap"></span> classobj.setText(&quot;Sample T&quot;);</i></div>
<div><i>      Console.WriteLine(&quot;Sample T -&gt; &quot; + classobj.getTextString());</i></div>
<div><i><span style="white-space:pre-wrap"></span> classobj.setText(&quot;\&quot;Sample T\&quot;&quot;);</i></div>
<div><i>      Console.WriteLine(&quot;\&quot;Sample T\&quot; -&gt; &quot; + classobj.getTextString());</i></div>
</div>
<div><br>
</div>
<div>I got the following output (from trunk):</div>
<div><br>
</div>
<div>
<div>Sample Text -&gt; &quot;Sample Text&quot;</div>
<div>Sample T -&gt; &quot;Sample&quot;</div>
<div>&quot;Sample T&quot; -&gt; &quot;Sample T&quot;</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>6.0 branch produces this:</div>
<div><br>
</div>
<div>
<div>Sample Text -&gt; &quot;Sample&quot;</div>
<div>Sample T -&gt; &quot;Sample&quot;</div>
<div>&quot;Sample T&quot; -&gt; &quot;Sample T&quot;</div>
</div>
<div><br>
</div>
<div>Do we have a requirement that the texts must be quoted which is passed to <i>classobj.setText?</i></div>
<div><br>
</div>
<div>Best regards,</div>
<div><br>
</div>
<div>Tamas</div>
<div><br>
</div>
</div>
</div></div></div>
</div>
</div>

</blockquote></div><br></div>