Snippets tagged “unicode”
12 snippets use this tag.
- Convert a Unicode string to a string in Python (containing extra symbols)Python
You can use the .encode() method to convert a Unicode string to a string containing extra symbols in Python.
- Convert character to ASCII numeric value in javaJava
To convert a character to its ASCII numeric value in Java, you can use the charAt method of the String class and the intValue method of the Character class.
- Convert int to char in javaJava
To convert an int value to a char value in Java, you can use the char type's conversion method, (char).
- error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start bytePython
Here is an example of how to handle a UnicodeDecodeError caused by an invalid start byte:
- How to decode Unicode escape sequences like "\u00ed" to proper UTF-8 encoded characters?PHP
In PHP, you can use the utf8_decode() function to decode a string that contains Unicode escape sequences.
- How to Encode and Decode Strings with Base64 in JavaScriptJavaScript
Read this tutorial and learn useful information about two JavaScript built-in functions which are used to convert a string to and from base64 encoding.
- Unicode (UTF-8) reading and writing to files in PythonPython
To read a file in Unicode (UTF-8) encoding in Python, you can use the built-in open() function, specifying the encoding as "utf-8".
- Unicode character in PHP stringPHP
You can use Unicode characters in a PHP string by including the character directly in the string, or by using the \u escape sequence followed by the Unicode code point of the character in hexadecimal.
- UnicodeDecodeError: 'charmap' codec can't decode byte X in position Y: character maps to <undefined>Python
This error occurs when trying to decode a string using the 'charmap' codec, which is typically used for Windows-1252 character encoding.
- UnicodeDecodeError: 'utf8' codec can't decode byte 0xa5 in position 0: invalid start bytePython
This error occurs when trying to decode a byte string using the UTF-8 codec and the byte at the given position is not a valid start byte for a UTF-8 encoded character.
- UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 20: ordinal not in range(128)Python
This error is raised when trying to encode a Unicode string using the ASCII codec, and the string contains a character that is not within the ASCII range (0-127).
- What are all the escape characters?Java
In Java, an escape character is a character that is preceded by a backslash (\) and is used to represent special characters or character sequences.