Closed seamus-45 closed 8 years ago
With below code I always get: UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
#!/usr/bin/env python2 # -*- coding: utf-8 -*- from augeas import Augeas val = 'Привет' aug = Augeas() aug.set('/augeas/load/Desktop/lens','desktop.lns') aug.set('/augeas/load/Desktop/incl','/tmp/mate-screenshot.desktop') aug.load() aug.set('/files/tmp/mate-screenshot.desktop/Desktop Entry/Name',val) aug.save()
It looks like value is encoded twice. When I declare val = u'Привет' as unicode string error is gone.
val = u'Привет'
But, first example of code works great without enc() function at all. Also there is related issue, which forced me to create a bug report
With below code I always get:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
It looks like value is encoded twice. When I declare
val = u'Привет'
as unicode string error is gone.But, first example of code works great without enc() function at all. Also there is related issue, which forced me to create a bug report