35 const unsigned char *from;
39 unsigned char from2[7];
43 from = (
const unsigned char *)orig.
c_str();
46 for (text =
""; *from; from++) {
49 if ((*from & 128) != 128) {
54 if ((*from & 128) && ((*from & 64) != 64)) {
61 for (subsequent = 1; (from2[0] & 128) && (subsequent < 7); subsequent++) {
63 from2[subsequent] = from[subsequent];
64 from2[subsequent] &= 63;
66 ch |= from2[subsequent];
70 char significantFirstBits = 8 - (2+subsequent);
72 ch |= (((short)from2[0]) << (((6*subsequent)+significantFirstBits)-8));
75 utf16 = (
signed short)ch;
78 sprintf(digit,
"%d", utf16);
83 utf16 = (
signed short)((ch - 0x10000) / 0x400 + 0xD800);
86 sprintf(digit,
"%d", utf16);
89 utf16 = (
signed short)((ch - 0x10000) % 0x400 + 0xDC00);
92 sprintf(digit,
"%d", utf16);
#define SWORD_NAMESPACE_START
const char * c_str() const
#define SWORD_NAMESPACE_END
virtual char processText(SWBuf &text, const SWKey *key=0, const SWModule *module=0)