0

I have comments in my java file that contain accented letters (my name in the header). When I Build in ST3 I get the error:

java:5: error: unmappable character for encoding ASCII

Is there any way to fix this other than removing all non-ASCII characters?

1 Answers1

1

You can make it with sublime-build package. Here is the default for python:

{
    "shell_cmd": "C:\\python33\\python.exe -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

Where I have found it is, inside

[the sublime installation dir @progfiles]\Packages\Python.sublime-package

which is actually a ZIP file. Open it with wizip / winrar / 7zip or etc copy the file content of "Python.sublime-build" file. Inside the Sublime Text editor, from the menu go to

Tool > Build System > New Build System

You can do same for Java easily. If cannot, let people here know.

edit: (I got this from here) I guess this will work. Go to the menu of Sublime as "Tool > Build System > New Build System". A new file will open, replace the content as:

{
    "cmd": ["javac", "-Dfile.encoding=UTF8", "-Xlint", "$file"],
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": "source.java",
    "variants": [
        { "cmd": ["javac", "-Xlint", "$file"],
          "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
          "selector": "source.java",
          "name": "Java Lintter"
        },
        { 
          "cmd": ["java", "-Dfile.encoding=UTF8", "$file_base_name"],
          "name": "Run Java"
        }
    ]
}

You can check here and here.

Community
  • 1
  • 1
JSBach
  • 447
  • 1
  • 6
  • 13
  • I cannot find this folder. It could be that I'm using Sublime Text 3 on a Mac. – KristjanJonsson Jan 11 '14 at 20:20
  • I noticed it should be under "Packages" directory under App Directory and edit that with more information. You can now try what I have written without finding that anyway. – JSBach Jan 12 '14 at 02:07
  • Are you using ST3 or ST2 because I don't seem to have the same folder structure as you? My packages folder is almost empty. No python or java folder there. Do I need to install a package for this? – KristjanJonsson Jan 14 '14 at 16:10
  • ST3 as you do. Just forget about the directories. You can do what I tell you without the folder/file thing. Inside the SublimeText3, you will just use the menu. [I have a screenshot for you as in here.](http://imgur.com/QOD3y6f) – JSBach Jan 18 '14 at 23:40
  • javac: invalid flag: -Dfile.encoding=UTF8 Usage: javac use -help for a list of possible options – Zachooz Nov 23 '14 at 19:05