Ubuntu Pastebin

Paste from skay at Thu, 1 Jun 2017 16:12:29 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> smart_text
Traceback (most recent call last):
  File "<console>", line 1, in <module>
NameError: name 'smart_text' is not defined
>>> from django.utils.encoding import smart_text
>>> data = b"\xc0\xed\xa3\x8b"
>>> smart_text(data, errors="replace", encoding="utf-8", strings_only=True)
u'\ufffd\ud8cb'
>>> x = smart_text(data, errors="replace", encoding="utf-8", strings_only=True)                                                                                              
>>> len(x)
2
>>> x.encode('utf-8')
'\xef\xbf\xbd\xed\xa3\x8b'
>>>
Download as text