Answer the question
In order to leave comments, you need to log in
How to convert string in python from utf-16 to utf-8?
There is a line:
Ą᠄䄄㼄㸄㬄䰄㜄䌄㤄䈄㔀 㨄㸄㐀 㤀 㠀 ㌀㜀㐀 㐄㬄伀 㼄㸄㐄䈄㈄㔄䀄㘄㐄㔄㴄㠄伀 䄄㈄㸄㔄㌄㸀 〄㨄㨄〄䌄㴄䈄
I know that in utf-16be encoding, help me convert to utf-8. I tried using codecs, the result is krakozyabry. The result is in Russian, it has a 6-digit digital code. Simple ways like encode-decode do nothing
Answer the question
In order to leave comments, you need to log in
Here is the code:
# -*- coding: utf-8 -*-
s = 'Ą᠄䄄㼄㸄㬄䰄㜄䌄㤄䈄㔀 㨄㸄㐀 㤀 㠀 ㌀㜀㐀 㐄㬄伀 㼄㸄㐄䈄㈄㔄䀄㘄㐄㔄㴄㠄伀 䄄㈄㸄㔄㌄㸀 〄㨄㨄〄䌄㴄䈄'
print(s.encode('utf-16be').decode('utf-16le'))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question