Skip to main content
error
Source Link
Siddharthan Asokan
  • 4.5k
  • 11
  • 48
  • 83

I'm aware of the fact that for Python < 3, unicode encoding for the string 'Plants vs. Zombies䋢 2' is as below:

u"Plants vs. Zombies䋢 2".encode("utf-8")

What if I have an variable (say appName) instead of a string can I do it like this:

  appName = "Plants vs. Zombies䋢 2"
 u+appName.encode("utf-8")

For:

 appName = appName.encode('utf-8');


 'ascii' codec can't decode byte 0xe4 in position 18: ordinal not in range(128)

I'm aware of the fact that for Python < 3, unicode encoding for the string 'Plants vs. Zombies䋢 2' is as below:

u"Plants vs. Zombies䋢 2".encode("utf-8")

What if I have an variable (say appName) instead of a string can I do it like this:

  appName = "Plants vs. Zombies䋢 2"
 u+appName.encode("utf-8")

I'm aware of the fact that for Python < 3, unicode encoding for the string 'Plants vs. Zombies䋢 2' is as below:

u"Plants vs. Zombies䋢 2".encode("utf-8")

What if I have an variable (say appName) instead of a string can I do it like this:

  appName = "Plants vs. Zombies䋢 2"
 u+appName.encode("utf-8")

For:

 appName = appName.encode('utf-8');


 'ascii' codec can't decode byte 0xe4 in position 18: ordinal not in range(128)
contents of appName
Source Link
Siddharthan Asokan
  • 4.5k
  • 11
  • 48
  • 83

I'm aware of the fact that for Python < 3, unicode encoding for the string 'Plants vs. Zombies䋢 2' is as below:

u"Plants vs. Zombies䋢 2".encode("utf-8")

What if I have an variable (say appName) instead of a string can I do it like this:

  appName = "Plants vs. Zombies䋢 2"
 u+appName.encode("utf-8")

I'm aware of the fact that for Python < 3, unicode encoding for the string 'Plants vs. Zombies䋢 2' is as below:

u"Plants vs. Zombies䋢 2".encode("utf-8")

What if I have an variable (say appName) instead of a string can I do it like this:

 u+appName.encode("utf-8")

I'm aware of the fact that for Python < 3, unicode encoding for the string 'Plants vs. Zombies䋢 2' is as below:

u"Plants vs. Zombies䋢 2".encode("utf-8")

What if I have an variable (say appName) instead of a string can I do it like this:

  appName = "Plants vs. Zombies䋢 2"
 u+appName.encode("utf-8")
Source Link
Siddharthan Asokan
  • 4.5k
  • 11
  • 48
  • 83

Python string encoding for a variable

I'm aware of the fact that for Python < 3, unicode encoding for the string 'Plants vs. Zombies䋢 2' is as below:

u"Plants vs. Zombies䋢 2".encode("utf-8")

What if I have an variable (say appName) instead of a string can I do it like this:

 u+appName.encode("utf-8")