On Wed, Aug 17, 2011 at 6:21 AM, jerickson <[email protected]> wrote:
> Hi all!
>
> I am trying to reduplicate the "Showing one Way" example found in Andrea's
> wonderful "GeoServer Cartographic Rendering" presentation [1] from FOSS4G
> 2010 in code using GeoTools StyleFactory (ultimately for GeoScript). When I
> run this code snippet:
>
> TextSymbolizer text = styleFactory.createTextSymbolizer();
> text.setFont(styleFactory.createFont(filterFactory.literal("Lucida Sans"),
> filterFactory.literal("normal"), filterFactory.literal("bold"),
> filterFactory.literal("10")));
> text.setLabel(filterFactory.literal("&amp;#x2192;"));
>
> I get an image with labels '&amp;#x2192;' instead of arrows (see attached
> image line_with_arrows.png). When I write this Style to SLD I see that the
> '&' has been escaped:
>
> <sld:TextSymbolizer>
>    <sld:Label>
>      <ogc:Literal>&amp;amp;#x2192;</ogc:Literal>
>    </sld:Label>
> </sld:TextSymbolizer>
>
> When I change the SLD to <ogc:Literal>&amp;#x2192;</ogc:Literal> and
> regenerate my image I get the correct result (see attached image
> line_with_arrow_from_sld.png).  I am missing something or is this a bug?  If
> it's a bug I can file an issue with JIRA.

You're mixing up xml encoding and in memory representation.
In memory you don't have to escape stuff as if you intended to write it
in XML, dealing with escaping is the duty of the xml parsers/encoders.
For example, what if we were writing the style in David's CSS instead?
The escaping rules might be different there

Cheers
Andrea



-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to