Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
497a5980
Commit
497a5980
authored
Jan 31, 2014
by
Andrew Udvare
Committed by
Nikias Bassen
Feb 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force all dictionaries keys to be UTF-8 in Python 3
parent
29672075
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
plist.pyx
cython/plist.pyx
+7
-8
No files found.
cython/plist.pyx
View file @
497a5980
...
...
@@ -4,13 +4,7 @@ from libc.stdint cimport *
# https://groups.google.com/forum/#!topic/cython-users/xoKNFTRagvk
cdef _from_string_and_size(char *s, size_t length):
if PY_MAJOR_VERSION < 3 or s == NULL:
return s[:length]
if s == NULL:
return s[:length]
else:
return s[:length].decode("ascii")
return s[:length].encode('utf-8')
cdef extern from *:
ctypedef enum plist_type:
...
...
@@ -606,7 +600,12 @@ cdef class Dict(Node):
plist_dict_next_item(self._c_node, it, &key, &subnode);
while subnode is not NULL:
cpython.PyDict_SetItem(self._map, key, plist_t_to_node(subnode, False))
py_key = key
if PY_MAJOR_VERSION >= 3:
py_key = py_key.decode('utf-8')
cpython.PyDict_SetItem(self._map, py_key, plist_t_to_node(subnode, False))
subnode = NULL
libc.stdlib.free(key)
key = NULL
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment