summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-12-18 08:23:09 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-12-18 08:23:09 (GMT)
commit29e2aa696d5db7705c498738a16525cbcd0b0ee3 (patch)
tree3db73fe07011a9089e2eea4b72aaa1f9ca84f7c8 /PC
parente0cb9da9d6dcb4aa7d8398f2b603311f2f63a12d (diff)
downloadcpython-29e2aa696d5db7705c498738a16525cbcd0b0ee3.zip
cpython-29e2aa696d5db7705c498738a16525cbcd0b0ee3.tar.gz
cpython-29e2aa696d5db7705c498738a16525cbcd0b0ee3.tar.bz2
Test UTF-32LE before UTF-16LE since UTF-16LE BOM is a prefix of UTF-32LE BOM.
Diffstat (limited to 'PC')
-rw-r--r--PC/launcher.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/PC/launcher.c b/PC/launcher.c
index e414237..121aa5b 100644
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -965,10 +965,12 @@ typedef struct {
*/
static BOM BOMs[] = {
{ 3, { 0xEF, 0xBB, 0xBF }, CP_UTF8 }, /* UTF-8 - keep first */
- { 2, { 0xFF, 0xFE }, CP_UTF16LE }, /* UTF-16LE */
- { 2, { 0xFE, 0xFF }, CP_UTF16BE }, /* UTF-16BE */
+ /* 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 */
{ 0 } /* sentinel */
};