About 51 results
Open links in new tab
  1. How to convert a string to utf-8 in Python - Stack Overflow

    May 3, 2018 · I have a browser which sends utf-8 characters to my Python server, but when I retrieve it from the query string, the encoding that Python returns is ASCII. How can I convert the plain string to …

  2. Working with UTF-8 encoding in Python source - Stack Overflow

    Jun 9, 2011 · In Python 3, UTF-8 is the default source encoding (see PEP 3120), so Unicode characters can be used anywhere. In Python 2, you can declare in the source code header:

  3. unicode - python encoding utf-8 - Stack Overflow

    Feb 26, 2013 · Unfortunately, the string.encode () method is not always reliable. Check out this thread for more information: What is the fool proof way to convert some string (utf-8 or else) to a simple …

  4. Unicode (UTF-8) reading and writing to files in Python

    913 Rather than mess with .encode and .decode, specify the encoding when opening the file. The io module, added in Python 2.6, provides an io.open function, which allows specifying the file's …

  5. unicode - How to make python 3 print () utf8 - Stack Overflow

    Aug 30, 2010 · TestText2 = TestText.encode('utf8') # this is a UTF-8-encoded byte string. To send UTF-8 to stdout regardless of the console's encoding, use the its buffer interface, which accepts bytes:

  6. Python 3 - Encode/Decode vs Bytes/Str - Stack Overflow

    Encode () returns an 8-bit string in both cases. It's called "str" in Python 2 and "bytes" in Python 3, but both are 8-bit strings.

  7. python - Convert every dictionary value to utf-8 (dictionary ...

    [unicode(s).encode("utf-8") for s in row] but I'm not sure how to do the equivalent thing for dictionaries. This is different from Python Dictionary Comprehension because I'm not trying to create a dictionary …

  8. How to use .encode ('utf-8') in Python? - Stack Overflow

    Dec 8, 2015 · How to use .encode ('utf-8') in Python? Asked 10 years, 1 month ago Modified 4 years, 10 months ago Viewed 11k times

  9. How to convert a file to utf-8 in Python? - Stack Overflow

    86 I need to convert a bunch of files to utf-8 in Python, and I have trouble with the "converting the file" part. I'd like to do the equivalent of:

  10. Unicode utf-8/utf-16 encoding in Python - Stack Overflow

    It's a unicode character that doesn't seem to be displayable in your terminals encoding. print tries to encode the unicode object in the encoding of your terminal and if this can't be done you get an …