ext/riconv.c in rjb-1.6.8 vs ext/riconv.c in rjb-1.6.9

- old
+ new

@@ -12,11 +12,10 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * $Id: riconv.c 117 2010-06-04 12:16:25Z arton $ */ - #include "ruby.h" #include "extconf.h" #if defined _WIN32 || defined __CYGWIN__ #include <windows.h> @@ -194,15 +193,18 @@ } static int contains_auxchar(const unsigned char* p) { while (*p) { - if (*p == 0xed) + if (*p == 0xed && *(p + 1) && *(p + 1)) { #if defined(DEBUG) - printf("find %02x %02x %02x %02x %02x %02x\n", *p, *(p + 1), *(p + 2), *(p + 3), *(p + 4), *(p + 5)); + printf("find %02x %02x %02x %02x %02x %02x\n", *p, *(p + 1), *(p + 2), *(p + 3), *(p + 4), *(p + 5)); #endif - return 1; + if ((*(p + 1) & 0xa0) == 0xa0 && (*(p + 2) & 0xb0) == 0xb0) + { + return 1; + } } switch (*p & 0xe0) { case 0xe0: p++;