Skip to content
Advertisement

Tag: encoding

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

URL decoding: UnsupportedEncodingException in Java

What I understand from the documentation is that UnsupportedEncodingException can only be thrown if I specify a wrong encoding as the second parameter to URLDecoder.decode(String, String) method. Is it so? I need to know cases where this exception can be thrown. Basically, I have this code segment in one of my functions: Since I am explicitly mentioning “UTF-8”, is there

Java FileReader encoding issue

I tried to use java.io.FileReader to read some text files and convert them into a string, but I found the result is wrongly encoded and not readable at all. Here’s my environment: Windows 2003, OS encoding: CP1252 Java 5.0 My files are UTF-8 encoded or CP1252 encoded, and some of them (UTF-8 encoded files) may contain Chinese (non-Latin) characters. I

Advertisement