hacking: Remove references to encoding

This is no longer an issue in our new Python 3-only world.

Change-Id: I25c31a0b7f76a253499d9713ba48fd7ba7168450
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2021-03-31 18:18:55 +01:00 committed by Stephen Finucane
parent 87e6828678
commit f00e14f400
1 changed files with 1 additions and 47 deletions

View File

@ -32,7 +32,7 @@ use the alternate 4 space indent. With the first argument on the succeeding
line all arguments will then be vertically aligned. Use the same convention
used with other data structure literals and terminate the method call with
the last argument line ending with a comma and the closing paren on its own
line indented to the starting line level.
line indented to the starting line level. ::
'string one',
@ -40,49 +40,3 @@ line indented to the starting line level.
kwarg2=['a', 'b', 'c'],
Text encoding
Note: this section clearly has not been implemented in this project yet, it is
the intention to do so.
All text within python code should be of type 'unicode'.
>>> s = 'foo'
>>> s
>>> type(s)
<type 'str'>
>>> u = u'foo'
>>> u
>>> type(u)
<type 'unicode'>
Transitions between internal unicode and external strings should always
be immediately and explicitly encoded or decoded.
All external text that is not explicitly encoded (database storage,
commandline arguments, etc.) should be presumed to be encoded as utf-8.
infile = open('testfile', 'r')
mystring = infile.readline()
myreturnstring = do_some_magic_with(mystring)
infile = open('testfile', 'r')
mystring = infile.readline()
mytext = mystring.decode('utf-8')
returntext = do_some_magic_with(mytext)
returnstring = returntext.encode('utf-8')