This caused that for characters with codes > 0x80 we skipped one byte. Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- vm/utf8.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/vm/utf8.c b/vm/utf8.c index c9caf88..85355e3 100644 --- a/vm/utf8.c +++ b/vm/utf8.c @@ -2,6 +2,7 @@ #include <string.h> #include <stdio.h> +#include "vm/die.h" #include "vm/object.h" #include "vm/types.h" #include "vm/utf8.h" @@ -59,9 +60,9 @@ struct vm_object *utf8_to_char_array(const uint8_t *bytes, unsigned int n) return array; } - for (unsigned int i = 0, j = 0; i < n; ++i) { + for (unsigned int i = 0, j = 0; i < n;) { if (!(bytes[i] & 0x80)) { - array_set_field_char(array, j++, bytes[i]); + array_set_field_char(array, j++, bytes[i++]); continue; } @@ -79,6 +80,8 @@ struct vm_object *utf8_to_char_array(const uint8_t *bytes, unsigned int n) array_set_field_char(array, j++, ch); continue; } + + error("invalid utf8 sequence"); } return array; -- 1.6.0.6 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel