Jukka, I agree that the BOM should not be required. Looking at the original email provided by the reporter, the SLD appears corrupt, as it contains a malformed UTF-8 byte sequence, confirmed by inspection of the actual byres. Editing this file with Notepad++ likely re-encodes it. I still suspect a platform encoding problem.
Kind regards, Ben. On 06/11/16 11:13, Rahkonen Jukka (MML) wrote: > Hi Ben, > > You did not perhaps notice the mail telling that the SLD file encoding should > be set to UTF-8 with BOM and then it started to work. > I think that it is good to accept BOM but it should not be required. > > Jukka Rahkonen > ________________________________ > Lähettäjä: Ben Caradoc-Davies<mailto:b...@transient.nz> > Lähetetty: 5.11.2016 23:52 > Vastaanottaja: am2222<mailto:asd5...@yahoo.com> > Kopio: > geoserver-users@lists.sourceforge.net<mailto:geoserver-users@lists.sourceforge.net> > Aihe: Re: [Geoserver-users] Right to left language (Arabic, Persian) problem > in SLD Legend > > GeoServer can always output UTF-8 because Java supports UTF-8. Problems > can arise when GeoServer tries to save files such as your SLD on a > platform with an encoding that does not support all the characters in > the file. This can cause files to be corrupted. > > What is the platform on which you are running GeoServer, and what is its > character encoding? I guess you are on Windows if you are using > Notepad++, but what what version and character encoding? Also, what > GeoServer version? > > My guess is that the SLD file is being transformed into the platform > encoding when saved (best effort), and where characters cannot be > represented, they are being replaced with placeholders, corrupting the > file. Your Notepad++ findings seem to confirm this. Notepad++ might not > transform the file, instead saving it as raw bytes. > > You might be able to change the behaviour of GeoServer by starting the > JVM with the option: > > -Dfile.encoding=UTF8 > > to force Java to read and write your SLD as UTF-8. Where to put it > depends on how you start GeoServer. This may have other side effects if > you have files stored in another encoding. My preferred solution is to > use UTF-8 everywhere. > > I am using Linux (Debian unstable) with locale en_GB.utf8 (that is, > UTF-8 as the platform encoding). I tested the GeoServer release data > directory (on master (2.11-SNAPSHOT)) by changing the Title of the first > Rule of the population style to فارسی (see attached screenshot). > Wikipedia tells me that this is Farsi for Farsi. I was able save and > load the style, and the USA Population layer preview continued to work > as expected. The GeoServer web SLD editor honours right-to-left display > for the Farsi text. > > I also examined the corresponding popshade.sld file and found that the > Title was updated correctly to <Title>فارسی</Title>, both in a text > editor that honours right-to-left when displaying text, and at a console > that does not (to check raw ordering). > > Kind regards, > Ben. > > On 05/11/16 11:57, am2222 wrote: >> Thanks dear Ben, >> Unicode of geoserver is set up Utf-8 on settings,the part that you >> mentioned is exacly a text which is written in Persian,what do you suggest >> to fix it?Is there any way to fix it?or sld files does not support Such a >> languages? >> Thanks >> >> On Nov 4, 2016 11:40 PM, "Ben Caradoc-Davies-2 [via OSGeo.org]" < >> ml-node+s1560n5294392...@n6.nabble.com> wrote: >> >>> What is the character encoding used by your GeoServer instance? Is your >>> server using UTF-8? >>> >>> Text files containing UTF-8 byte sequences that are written to a server >>> that does not support these UTF-8 byte sequences might be corrupted when >>> unsupported characters are replaced with other bytes as placeholders. >>> This could make files valid for the server encoding but invalid UTF-8. >>> >>> If I open your SLD in Firefox 49, it correctly detects the encoding as >>> UTF-8 but reports the following error: >>> http://osgeo-org.1560.x6.nabble.com/file/n5294270/BaftFarsoode.sld >>> >>> XML Parsing Error: not well-formed >>> Location: http://osgeo-org.1560.x6.nabble.com/file/n5294270/ >>> BaftFarsoode.sld >>> Line Number 14, Column 18: <Title>���� ������</Title> >>> -----------------^ >>> >>> This is consistent with the exception you report (copying from Nabble as >>> I do not see the log in the mailing list email): >>> >>> INFO | jvm 1 | 2016/11/04 22:49:36 | java.lang.RuntimeException: >>> com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: >>> >>> Invalid byte 2 of 2-byte UTF-8 sequence. >>> INFO | jvm 1 | 2016/11/04 22:49:36 | at >>> org.geotools.styling.SLDParser.parseSLD(SLDParser.java:430) >>> >>> Kind regards, >>> Ben. >>> >>> On 05/11/16 08:26, am2222 wrote: >>>> This is the log File when I save style with unicode characters. Any >>>> suggestion? >>> >>> -- >>> Ben Caradoc-Davies <[hidden email] >>> <http:///user/SendEmail.jtp?type=node&node=5294392&i=0>> >>> Director >>> Transient Software Limited <http://transient.nz/> >>> New Zealand >>> >>> ------------------------------------------------------------------------------ >>> >>> Developer Access Program for Intel Xeon Phi Processors >>> Access to Intel Xeon Phi processor-based developer platforms. >>> With one year of Intel Parallel Studio XE. >>> Training and support from Colfax. >>> Order your platform today. http://sdm.link/xeonphi >>> _______________________________________________ >>> Geoserver-users mailing list >>> [hidden email] <http:///user/SendEmail.jtp?type=node&node=5294392&i=1> >>> https://lists.sourceforge.net/lists/listinfo/geoserver-users >>> >>> >>> ------------------------------ >>> If you reply to this email, your message will be added to the discussion >>> below: >>> http://osgeo-org.1560.x6.nabble.com/Right-to-left-language-Arabic-Persian- >>> problem-in-SLD-Legend-tp5294270p5294392.html >>> To unsubscribe from Right to left language (Arabic,Persian) problem in SLD >>> Legend, click here >>> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5294270&code=YXNkNTZ5dUB5YWhvby5jb218NTI5NDI3MHwzMzgwOTUyOTA=> >>> . >>> NAML >>> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >>> >> >> >> >> >> -- >> View this message in context: >> http://osgeo-org.1560.x6.nabble.com/Right-to-left-language-Arabic-Persian-problem-in-SLD-Legend-tp5294270p5294398.html >> Sent from the GeoServer - User mailing list archive at Nabble.com. >> >> >> >> ------------------------------------------------------------------------------ >> Developer Access Program for Intel Xeon Phi Processors >> Access to Intel Xeon Phi processor-based developer platforms. >> With one year of Intel Parallel Studio XE. >> Training and support from Colfax. >> Order your platform today. http://sdm.link/xeonphi >> >> >> >> _______________________________________________ >> Geoserver-users mailing list >> Geoserver-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/geoserver-users >> > > -- > Ben Caradoc-Davies <b...@transient.nz> > Director > Transient Software Limited <http://transient.nz/> > New Zealand > -- Ben Caradoc-Davies <b...@transient.nz> Director Transient Software Limited <http://transient.nz/> New Zealand ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users