Skip to content

Tag: encoding

Properly set UTF-8 encoding to a FileHandler in Java

I initialize my FileHandler as follows: and add it to my Logger like this: If i remove the setEncoding on my FileHandler, its sill is wrong. But strangely, if i add the exact same Encoding to my ConsoleHandler, it stops working too. (But without the explicit set, it works at least in my IntelliJ-Console). IntelliJ-Console WITHOUT the explicit encoding (same

Encoding Problem while saving a txt file in utf-8

The follwing line should write a ΓΌ in test.txt encoded in utf-8- At least this is what I expect it to do. But if I open the file in a text editor, the editor shows and the editor states that it would read the file as utf-8. I even tried two editors and both show the same unexpected result. A

Java URI doesn’t encode semicolons in path. Best practice here?

I’m working on a project where a local file is exported via HTTP. This involves getting a file URI, relativizing it using the exported path, tacking it onto the export URI and then handling that as a URL on the receiving end. Normally this works fine, but I run into trouble when the filename contains a semicolon. I narrowed it