Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  (Fixed) Text viewer breaks multi-bytes characters
« previous next »
  • Print
Pages: [1]

Author Topic: (Fixed) Text viewer breaks multi-bytes characters  (Read 1746 times)

Offline xhuang

  • Member
  • *
  • Posts: 1
(Fixed) Text viewer breaks multi-bytes characters
« on: September 12, 2008, 01:07:55 PM »
I have been having problem reading Chinese articles in my Sansa e250 because when a certain line is mixture of ascii chars and chinese chars the text viewer may break line in between a chinese charater which results the rest of the paragraph becomes unreadable.

After investigatng the source code of viewer.c I spotted the problem is at function

   unsigned char* get_ucs(const unsigned char* str, unsigned short* ch)

which, given the codepage is non-English, thinks the unicode size of an ascii char is 2. I fixed the problem by simply change this line:

  if ((prefs.encoding == SJIS && *str > 0xA0 && *str < 0xE0) || prefs.encoding < SJIS)

to

  if (*ch < 0x100 || (prefs.encoding == SJIS && *str > 0xA0 && *str < 0xE0) || prefs.encoding < SJIS)

Passed test on my Sansa e250.
Logged

Offline Chronon

  • Rockbox Expert
  • Member
  • *
  • Posts: 4383
Re: (Fixed) Text viewer breaks multi-bytes characters
« Reply #1 on: September 12, 2008, 01:54:16 PM »
Thank you.  The preferred method for submitting changes back for inclusion is to sign up for a Flyspray account and post a patch to the tracker.  (Follow the "patches" link on the sidebar.)
Logged
Sansa e280, Gigabeat F40, Gigabeat S60, Sansa Clip+, iPod Mini 2g

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  (Fixed) Text viewer breaks multi-bytes characters
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.025 seconds with 17 queries.