"Decode error - output not utf-8" in Sublime Text

Asked

Viewed 1,363 times

4

I’ve looked at several websites, several questions (including in stackoverflow itself) I did a lot of research and I couldn’t get this error out of Sublime Text 2 yet:

[Decode error - output not utf-8]

The Language In Question Is Java, I’ve tried using one . bat to compile and run java, already tried to put "encoding": "utf-8" in Javac.sublime-build, already tried to go in file->Save with Encoding->UTF-8. My JDK is right on variable PATH, I have a variable called JAVA_HOME with value (C: Program Files Java jre8 bin).

My Javac.sublime-build is currently as it is normally:

{
    "cmd": ["javac", "$file"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.java"
}

I changed the Javac.sublime-build:

{
    "cmd": ["javac", "$file_name"], <- De "$file" para "$file_name"
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.java"
}

Now he’s compiling it without any mistakes but when I put it:

{
    "cmd": ["javac", "$file_name"],
    "cmd": ["java", "$file_base_name"], <- Adicionei Está Linha
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.java"
}

It gave error again [Decode error - output not utf-8]

Translating, for now I can only generate . class, but my purpose is to generate . class and run-Ló as well.

  • If you open it with another editor (e.g., Notepad++), you can see which encoding is?

  • @Victor I opened The Notepad++ and went on to format and it was "Encoding in UTF-8 (No GOOD)", but that’s the standard thing of the notepad++ or it’s really the encoding of the file ?

  • @Victor and also you want me to open what on Notepad++ ? Javac.sublime-build ? If it’s him, what I said above is right !!

  • There is no algorithm that precisely determines the encoding of the file (the reason is that imagine an empty file or with only a single letter 'a', how do you know if this is ASCII or UTF-8?). What these programs do is try to verify which encoding makes the most sense.

  • I don’t think Javac.sublime-build is the answer. Well friend, I’m sorry, but I have no idea how I can help you. Keep my +1 on your question, and good luck. If I have any ideas, I’ll come back here. :)

  • Blz, Thank you (:

Show 1 more comment

3 answers

1

"shell": true   

That is the key.

If I try one build system thus (in Win XP):

{
"cmd": ["ant", "-f", "project-build.xml"],
"working_dir": "${project_path}"
}

Give me:

[Decode error - output not utf-8]

That’s because cmd should be "ant.bat". Sublime is looking for a file whose name is exactly ant, and the encoding of the message "file does not exist" is not UTF-8. If you use shell like this:

{
"cmd": ["ant", "-f", "project-build.xml"],
"working_dir": "${project_path}",
"shell": true
}

everything works (even without "windows": { "cmd": ....}because the shell looks for ant.exe and then by ant.bat.

0

In my case I decided by renaming the folder containing the file. Leaving only one name, no dots, commas or spaces. I hope I helped.

0

See if your editor has option to change the character of the text, it is probably in cp1252, pass to UTF-8 (in eclipse by right clicking on the tree of the project), by Notepad++, in the top menu "Format >> convert to UTF-8"

I always work with fonts in UTF-8 the cp1252 gives many problems.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.