How-to articles, tricks, and solutions about CHARACTER-ENCODING

Best way to convert string to bytes in Python 3?

In Python 3, you can convert a string to bytes using the bytes function.

Getting ’ instead of an apostrophe(') in PHP

This can occur if your PHP code is using the ISO-8859-1 character set instead of UTF-8.

How to convert Strings to and from UTF8 byte arrays in Java

To convert a String to a UTF-8 encoded byte array in Java, you can use the getBytes method of the String class and specify the character encoding as "UTF-8".

Setting the default Java character encoding

To set the default character encoding for the Java Virtual Machine (JVM), you can use the -Dfile.encoding option when starting the JVM.

UTF8 Encoding problem - With good examples

UTF-8 is a character encoding that represents each character in a text document as a unique numerical code.

Working with UTF-8 encoding in Python source

Here is a code snippet that demonstrates how to work with UTF-8 encoding in a Python source file: