[Python-checkins] cpython (3.5): Test UTF-32LE before UTF-16LE since UTF-16LE BOM is a prefix of UTF-32LE BOM.

serhiy.storchaka python-checkins at python.org
Fri Dec 18 03:24:32 EST 2015


https://hg.python.org/cpython/rev/3106caffa79d
changeset: 99616:3106caffa79d
branch: 3.5
parent: 99611:12ca4a3695f9
user: Serhiy Storchaka <storchaka at gmail.com>
date: Fri Dec 18 10:23:09 2015 +0200
summary:
 Test UTF-32LE before UTF-16LE since UTF-16LE BOM is a prefix of UTF-32LE BOM.
files:
 PC/launcher.c | 6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/PC/launcher.c b/PC/launcher.c
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -965,10 +965,12 @@
 */
 static BOM BOMs[] = {
 { 3, { 0xEF, 0xBB, 0xBF }, CP_UTF8 }, /* UTF-8 - keep first */
+ /* Test UTF-32LE before UTF-16LE since UTF-16LE BOM is a prefix
+ * of UTF-32LE BOM. */
+ { 4, { 0xFF, 0xFE, 0x00, 0x00 }, CP_UTF32LE }, /* UTF-32LE */
+ { 4, { 0x00, 0x00, 0xFE, 0xFF }, CP_UTF32BE }, /* UTF-32BE */
 { 2, { 0xFF, 0xFE }, CP_UTF16LE }, /* UTF-16LE */
 { 2, { 0xFE, 0xFF }, CP_UTF16BE }, /* UTF-16BE */
- { 4, { 0xFF, 0xFE, 0x00, 0x00 }, CP_UTF32LE }, /* UTF-32LE */
- { 4, { 0x00, 0x00, 0xFE, 0xFF }, CP_UTF32BE }, /* UTF-32BE */
 { 0 } /* sentinel */
 };
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /