-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unicode: Preliminary commit, work-in-progress
- Loading branch information
1 parent
a4ff12d
commit d4cf5f6
Showing
30 changed files
with
159 additions
and
667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "ByteOrderMark.h" | ||
#include <stddef.h> | ||
|
||
|
||
const char *ucDetectBOM(const char *buf, int32_t bufsize){ | ||
if (bufsize < 4) return NULL; | ||
// copied from ICU | ||
if(buf[0] == '\xFE' && buf[1] == '\xFF') { | ||
return "UTF-16BE"; | ||
} else if(buf[0] == '\xFF' && buf[1] == '\xFE') { | ||
if(buf[2] == '\x00' && buf[3] =='\x00') { | ||
return "UTF-32LE"; | ||
} else { | ||
return "UTF-16LE"; | ||
} | ||
} else if(buf[0] == '\xEF' && buf[1] == '\xBB' && buf[2] == '\xBF') { | ||
return "UTF-8"; | ||
} else if(buf[0] == '\x00' && buf[1] == '\x00' && | ||
buf[2] == '\xFE' && buf[3]=='\xFF') { | ||
return "UTF-32BE"; | ||
} | ||
|
||
return NULL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef UNICODE_BOM_H_ | ||
#define UNICODE_BOM_H_ | ||
#include <inttypes.h> | ||
|
||
|
||
//Try to detect the Byte Order Mark of a Unicode Document | ||
//Returns either of: | ||
// "UTF-16BE" | ||
// "UTF-32LE" | ||
// "UTF-16LE" | ||
// "UTF-8" | ||
// "UTF-32BE" | ||
// NULL | ||
const char *ucDetectBOM(const char *buf, int32_t bufsize); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.