hyphenator does not handle non-ASCII characters correctly

RESOLVED FIXED in mozilla8

Status

()

Core
Internationalization
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: jfkthame, Assigned: jfkthame)

Tracking

Trunk
mozilla8
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

6 years ago
Created attachment 546742 [details] [diff] [review]
convert hyphenation-point offsets correctly to utf16 offsets

Because I misinterpreted the libhyphen API in bug 253317, hyphenation positions are not returned correctly when non-ASCII characters are present. (This doesn't affect the en-US patterns, but showed up once I started testing with more languages for bug 672320.)

The issue is that although the hnj_hyphen_hyphenate2() function takes the text as an 8-bit string, with a length in bytes, the hyphens array that it returns (when using UTF-8 dictionaries) is indexed by Unicode character count, not (as I assumed) by UTF-8 code unit positions in the input string.

This means that the conversion of hyphenation-point offsets to our UTF-16 text representation is incorrect.
Attachment #546742 - Flags: review?(smontagu)
Attachment #546742 - Flags: review?(smontagu) → review+
(Assignee)

Comment 1

6 years ago
Pushed to mozilla-inbound:
http://hg.mozilla.org/integration/mozilla-inbound/rev/faa1737443dd
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/faa1737443dd
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.