diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-03-01 13:31:36 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-03-01 13:31:36 +0000 |
| commit | f954a53da5edc1fc0a46c9a9cedb9ddaf5b0bf1f (patch) | |
| tree | 0a34258c6975c4eb311be40e079e4aa7ea1c41ff /apps/plugins/viewer.c | |
| parent | 342a7aacda674ffcdd26980014b1a628b3407e43 (diff) | |
| download | rockbox-f954a53da5edc1fc0a46c9a9cedb9ddaf5b0bf1f.zip rockbox-f954a53da5edc1fc0a46c9a9cedb9ddaf5b0bf1f.tar.gz rockbox-f954a53da5edc1fc0a46c9a9cedb9ddaf5b0bf1f.tar.bz2 rockbox-f954a53da5edc1fc0a46c9a9cedb9ddaf5b0bf1f.tar.xz | |
Quick hack to restore the reading of ISO encoded text files with the viewer plugin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8875 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/viewer.c')
| -rw-r--r-- | apps/plugins/viewer.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index f0f900c..f8e72be 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c @@ -598,6 +598,9 @@ static void viewer_draw(int col) unsigned char *line_end; unsigned char c; unsigned char scratch_buffer[MAX_COLUMNS + 1]; + unsigned char utf8_buffer[MAX_COLUMNS*4 + 1]; + int len; + unsigned char *endptr; /* If col==-1 do all calculations but don't display */ @@ -685,7 +688,11 @@ static void viewer_draw(int col) if (col != -1) if (k > col) { scratch_buffer[k] = 0; - rb->lcd_puts(left_col, i, scratch_buffer + col); + endptr = rb->iso_decode(scratch_buffer + col, utf8_buffer, + -1, k-col); + *endptr = 0; + len = rb->utf8length(utf8_buffer); + rb->lcd_puts(left_col, i, utf8_buffer); } } else if (line_mode == REFLOW) { @@ -773,7 +780,11 @@ static void viewer_draw(int col) if (col != -1) if (k > col) { scratch_buffer[k] = 0; - rb->lcd_puts(left_col, i, scratch_buffer + col); + endptr = rb->iso_decode(scratch_buffer + col, utf8_buffer, + -1, k-col); + *endptr = 0; + len = rb->utf8length(utf8_buffer); + rb->lcd_puts(left_col, i, utf8_buffer); } } else { /* line_mode != JOIN && line_mode != REFLOW */ @@ -781,7 +792,11 @@ static void viewer_draw(int col) if (line_len > col) { c = line_end[0]; line_end[0] = 0; - rb->lcd_puts(left_col, i, line_begin + col); + endptr = rb->iso_decode(line_begin + col, utf8_buffer, + -1, line_end-line_begin); + *endptr = 0; + len = rb->utf8length(utf8_buffer); + rb->lcd_puts(left_col, i, utf8_buffer); line_end[0] = c; } } |