Code Monkey home page Code Monkey logo

Comments (10)

sldeditor avatar sldeditor commented on July 24, 2024

I've added the capability of specifying the file encoding via the Tools->Options menu for now. This is stored in the config.properties file so will be remembered the next time the application is started. Sadly Java doesn't seem to be able to determine automatically what the file encoding is when reading it.

I've made a jar file and Windows installer available here.

Let me know if this has sorted the problem out.

from sldeditor.

yaras-phoenix avatar yaras-phoenix commented on July 24, 2024

Hmm, not working. I'm attaching sample test style so you could see exactly what I see.
test.txt
image

P.S. It seems there are more than one problematic char, not in this test case. Not yet localized it (or them) because the style is really huge.

from sldeditor.

sldeditor avatar sldeditor commented on July 24, 2024

I downloaded the file and loaded it up in UTF-8 and windows-1251 and got the following:
utf8
windows-1251

I think that implies that the test.txt file is UTF-8

from sldeditor.

yaras-phoenix avatar yaras-phoenix commented on July 24, 2024

I tried to reach above result (your screens) on two different Windows machines. I have just deleted and installed the latest java. No use.

Next I changed language for non-Unicode programs from russian to english and now the error is byte "1 of 1-byte..." instead of "byte 2 of 2-byte..." but error is still here.

Then I asked my ubuntu-colleague to download jar and test sld...it worked just like on your screens.

What OS do you use when testing my sld?

from sldeditor.

sldeditor avatar sldeditor commented on July 24, 2024

I've tested it on Windows 7 Java 1.8 rev 191 and Ubuntu Bionic Beaver 18.04 Java 1.8 rev 192.

What locale are you using?

from sldeditor.

yaras-phoenix avatar yaras-phoenix commented on July 24, 2024

Previous was Russian, it gave "byte 2 of 2-byte..."

current is English (UK), it gives "1 of 1-byte..."

from sldeditor.

sldeditor avatar sldeditor commented on July 24, 2024

What happens if you replace the first line of the sld file with the following:

<?xml version="1.0" encoding="windows-1251"?>

from sldeditor.

yaras-phoenix avatar yaras-phoenix commented on July 24, 2024

Issue is solved by adding env. variable JAVA_TOOL_OPTIONS with -Dfile.encoding=UTF-8 value or by modifying target field of the shortcut with "java -Dfile.encoding=UTF-8 -jar %JAR_LOCATION%\SLDEditor.jar".

So the solution isn't about changing the app - just about changing java setting.

from sldeditor.

sldeditor avatar sldeditor commented on July 24, 2024

I've just done an experiment and the call I used to get the 'system file encoding' was Charset.defaultCharset() and is overridden by the system property -Dfile.encoding. So calling Charset.defaultCharset() on my machines returns UTF-8 it returns something else on yours and is reset by using the -Dfile.encoding system property.

I've updated the code so that the file encoding is fixed to UTF-8 (I think this is as per the SLD specification) and removed the ability for the user to change it via the user interface. This will mean you wont need to set the -Dfile.encoding system property.

from sldeditor.

yaras-phoenix avatar yaras-phoenix commented on July 24, 2024

Thanks! Looking forward to get new version)

from sldeditor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.