Skip to content

CharacterDirectionOfLocale: Confusing reference to "characterOrder" #88

Closed
@anba

Description

@anba

CharacterDirectionOfLocale references "characterOrder":

If the default general ordering of characters (characterOrder) within a line in locale is right-to-left, return "rtl".

"characterOrder" is defined in UTS 35 here: https://unicode.org/reports/tr35/tr35-general.html#Layout_Elements.

ICU provides two functions which are relevant here: uloc_getCharacterOrientation and uloc_isRightToLeft.

The "characterOrder" property can be retrieved through uloc_getCharacterOrientation, but the V8 implementation uses uloc_isRightToLeft for its CharacterDirectionOfLocale implementation. Both ICU functions can produce different results when non-default scripts are used. For example for "en-Arab", uloc_getCharacterOrientation returns ULOC_LAYOUT_LTR, whereas uloc_isRightToLeft returns true.

The spec should be written so that implementers know which ICU function has to be called. I think it's probably best to remove "characterOrder" from CharacterDirectionOfLocale, because it seems to hint into the wrong direction (uloc_getCharacterOrientation, but we actually want uloc_isRightToLeft, right?).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions