Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
a58e93a3
Commit
a58e93a3
authored
May 29, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support UTF-8 BOMs inside source files
parent
153fd1eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
src/codegen/pypa-parser.cpp
src/codegen/pypa-parser.cpp
+6
-0
test/tests/parsing_bom.py
test/tests/parsing_bom.py
+0
-2
No files found.
src/codegen/pypa-parser.cpp
View file @
a58e93a3
...
...
@@ -1064,6 +1064,12 @@ std::string PystonSourceReader::get_line() {
break
;
line
.
push_back
(
c
);
}
while
(
c
!=
'\n'
&&
c
!=
'\x0c'
);
// check for UTF8 BOM
if
(
line_number
==
0
&&
line
[
0
]
==
'\xEF'
&&
line
[
1
]
==
'\xBB'
&&
line
[
2
]
==
'\xBF'
)
{
set_encoding
(
"utf-8"
);
line
.
erase
(
0
,
3
);
}
++
line_number
;
return
line
;
}
...
...
test/tests/parsing_bom.py
View file @
a58e93a3
# fail-if: '-x' not in EXTRA_JIT_ARGS
# I really don't understand all the intricacies of unicode parsing, but apparently in addition to
# Python-specific coding lines, you can put a unicode byte order mark to signify that the text
# is encoded.
...
...
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