<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">In 6.0 class->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>
exp->type = MS_STRING;<br>
exp->string = msStrdup(msyystring_buffer);<br>
<br>
// 5.6 branch<br>
exp->type = MS_STRING;<br>
if((strlen(value) - strlen(msyytext)) == 2)<br>
exp->string = strdup(msyytext); /* value was quoted */<br>
else<br>
exp->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>
exp->type = MS_STRING;<br>
if(... if first char in value is not a single or double quote ...)<br>
exp->string = strdup(value); /* use the whole value */<br>
else<br>
exp->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 tabindex="-1">
<div style="direction: ltr;" id="divRpF340322"><font color="#000000" face="Tahoma" size="2"><b>From:</b> mapserver-dev-bounces@lists.osgeo.org [mapserver-dev-bounces@lists.osgeo.org] on behalf of Tamas Szekeres [szekerest@gmail.com]<br>
<b>Sent:</b> Tuesday, February 21, 2012 4:09 PM<br>
<b>To:</b> mapserver-dev@lists.osgeo.org<br>
<b>Subject:</b> [mapserver-dev] classObj.setText, text must be quoted<br>
</font><br>
</div>
<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 class="Apple-tab-span" style="white-space: pre;"></span> classobj.setText("Sample Text");</i></div>
<div><i> Console.WriteLine("Sample Text -> " + classobj.getTextString());</i></div>
<div><i><span class="Apple-tab-span" style="white-space: pre;"></span> classobj.setText("Sample T");</i></div>
<div><i> Console.WriteLine("Sample T -> " + classobj.getTextString());</i></div>
<div><i><span class="Apple-tab-span" style="white-space: pre;"></span> classobj.setText("\"Sample T\"");</i></div>
<div><i> Console.WriteLine("\"Sample T\" -> " + classobj.getTextString());</i></div>
</div>
<div><br>
</div>
<div>I got the following output (from trunk):</div>
<div><br>
</div>
<div>
<div>Sample Text -> "Sample Text"</div>
<div>Sample T -> "Sample"</div>
<div>"Sample T" -> "Sample T"</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>6.0 branch produces this:</div>
<div><br>
</div>
<div>
<div>Sample Text -> "Sample"</div>
<div>Sample T -> "Sample"</div>
<div>"Sample T" -> "Sample T"</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>
</body>
</html>