2013/6/9 Andrea Aime <[email protected]>

> On Sun, Jun 9, 2013 at 4:14 PM, Jody Garnett <[email protected]>wrote:
>
>> Created a pull request for this:
>> https://github.com/geotools/geotools/pull/202
>>
>> Updated both gt-styling (in main) and gt-xsd-sld to support the new
>> extension.
>>
>> Checked it over, looks good. I may of missed it in the test cases, did
>> you support encoding on this one?
>>
>
> This is making me wonder... encoding is a general property of the XML
> file, and should be handled by the
> SAX parser... or am I missing something, and the client code should be
> doing something about it?
> Seen this one:
>
> http://stackoverflow.com/questions/12860115/not-able-to-parse-xml-file-containing-chinese-content
>
> which I find weird... the XML declares the charset, I thought the parser
> was supposed to read it and
> handle it automatically?
>
>

>From my experience, it's not the parser duty to handle the encoding. This
is usually done building a Reader using this weird syntax:

new InputStreamReader(<input_stream>, encoding)

but this assumes you already know the encoding of the stream you are going
to read.

In the past I used a framework (http://cpdetector.sourceforge.net/) that is
able to guess encoding from a stream and built a Reader using it to have
automatic encoding handling. CPDetector is a pluggable system using several
heuristics to detect a stream encoding.

I think Geotools / Geoserver are currently using the platform default
encoding in many cases (for example reading SLD and  freemarker templates)
and this is often causing issues when transferring a data_dir to a
different platform (for example from Windows to Linux).

Maybe something similar to cpdetector could be used to avoid encoding
issues like the above.

Mauro

-- 
==
GeoServer training in Milan, 6th & 7th June 2013! Visit
http://geoserver.geo-solutions.it for more information.
==

Dott. Mauro Bartolomeoli
@mauro_bart
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to