java - Weird Characters Displayed on Build, but not on Debug -
i'm developing java application using netbeans, while run app in debug, or plain running netbeans, screen looks so: . yet, when try run built jar in dist
folder, looks so: .
here method in using receive content. method intended source of text file web.
public static arraylist<string> geturlsource(string urlf) throws ioexception { url url = new url(urlf); scanner s = new scanner(url.openstream()); arraylist<string> filelines = new arraylist<>(); while (s.hasnextline()) { filelines.add(s.nextline()); } return filelines; }
the default charset may different depending on how launch application. try specifying charset explicitly :
scanner s = new scanner(url.openstream(), "utf-8");
Comments
Post a Comment