[sword-cvs] sword/src/modules/filters unicodertf.cpp,1.14,1.15
sword@www.crosswire.org
sword@www.crosswire.org
Fri, 9 May 2003 12:25:02 -0700
Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv3321
Modified Files:
unicodertf.cpp
Log Message:
Unicode Plane 1 support (UTF-8 -> UTF-32 -> UTF-16 -> RTF)
Index: unicodertf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/unicodertf.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** unicodertf.cpp 5 Apr 2003 08:49:17 -0000 1.14
--- unicodertf.cpp 9 May 2003 19:25:00 -0000 1.15
***************
*** 20,24 ****
const unsigned char *from;
char digit[10];
! short ch; // must be signed per unicode spec (negative is ok for big numbers > 32768)
unsigned char from2[7];
--- 20,25 ----
const unsigned char *from;
char digit[10];
! unsigned long ch;
! signed short utf16;
unsigned char from2[7];
***************
*** 56,64 ****
ch |= (((short)from2[0]) << (((6*subsequent)+significantFirstBits)-8));
from += subsequent;
! text += '\\';
! text += 'u';
! sprintf(digit, "%d", ch);
! text += digit;
! text += '?';
}
--- 57,82 ----
ch |= (((short)from2[0]) << (((6*subsequent)+significantFirstBits)-8));
from += subsequent;
! if (ch < 0x10000) {
! utf16 = (signed short)ch;
! text += '\\';
! text += 'u';
! sprintf(digit, "%d", utf16);
! text += digit;
! text += '?';
! }
! else {
! utf16 = (signed short)((ch - 0x10000) / 0x400 + 0xD800);
! text += '\\';
! text += 'u';
! sprintf(digit, "%d", utf16);
! text += digit;
! text += '?';
! utf16 = (signed short)((ch - 0x10000) % 0x400 + 0xDC00);
! text += '\\';
! text += 'u';
! sprintf(digit, "%d", utf16);
! text += digit;
! text += '?';
! }
}