0 votes
1 view
in Python by (19.9k points)

How can i write a python script to read an ASCII string and to convert it to a unicode string encoded by utf-8.

1 Answer

0 votes
by (25.1k points)

Since you are using python it is going to be really easy for you. You can do it by using the encode method on any string. In the encode method pass the encoding as a parameter such as 'utf-8' or 'utf-16'. Like this:

sample="String"

sample.encode('utf-8')

sample.encode('utf-16')

Check out this python course that will enable you to master python and it's libraries.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Sep 27, 2019 in Python by Sammy (47.8k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...