Some httpclient requires me to give a string charsetµ.
I am wondering whether to give it UTF8 or utf8 or UTF-8?
Especially when calling Charset.forName(enc)
There is no difference between "utf8" and "utf-8"; they are simply two names for UTF8, the most common Unicode encoding.
UTF-8 is a Unicode character encoding method. This means that UTF-8 takes the code point for a given Unicode character and translates it into a string of binary. It also does the reverse, reading in binary digits and converting them back to characters.
Fortunately UTF-8 is the default per sé. When reading an XML document and writing it in another encoding, mostly this attribute will be patched too.
Open the file in Notepad. Click 'Save As...'. In the 'Encoding:' combo box you will see the current file format. Yes, I opened the file in notepad and selected the UTF-8 format and saved it.
Easier to use StandardCharsets.UTF_8 as it saves you having to deal with UnsupportedEncodingExceptions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With