Skip to content
Snippets Groups Projects

dd_lightbar_menu: str_is_utf8() seems to return true sometimes when a string doesn't have UTF-8, so that is now commented out for now

Merged Eric Oulashin requested to merge dd_lightbar_menu_text_is_utf8_dont_use_str_is_utf8 into master
1 unresolved thread

dd_lightbar_menu: str_is_utf8() seems to return true sometimes when a string doesn't have UTF-8, so that is now commented out for now Having that appear true when it actually doesn't have UTF-8 characters is causing the lightbar menu to not display the whole menu item in some cases (perhaps due to the DDLightbarMenu logic).

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
    • All ASCII characters (and thus, ASCII strings) are also valid UTF-8 characters/strings.

      So... I'm not clear on what you mean by "sometimes"? If there's, say, a CP437 character in a string, then that string would not be a valid UTF-8 string, but all purely ASCII strings are valid UTF-8 strings.

      The JSDOC for this function says "Return true if the specified string contains only valid UTF-8 encoded and US-ASCII characters" - so I'm not clear if/how this function isn't behaving as expected or you just didn't read the "US-ASCII" part?

    • I haven't thoroughly tested it, so I don't know if it happens in all cases, which is why I said "sometimes". I understand that str_is_utf8() is meant to return true if the string contains only valid UTF-8 encoded and ASCII characters.

      The issue I'm seeing is with some of my mods - For instance, with my area choosers, they're taking the message group, sub-board, file libraries, and directory names from the BBS's configuration, and it's using those in lightbar menu items. I'm not using any UTF-8 characters in my area choosers, and for the group/sub-board/library/directory names, I had the impression that those don't have UTF-8 characters, but str_is_utf8() is returning true for the text strings in the menu item, and that's causing some display issues in my area chooser mods.

      Basically, this change reverts back to previous behavior which did not use str_is_utf8(), and that is enabling my other mods to work as expected for now.

    • Please register or sign in to reply
  • I would expect str_is_utf8() to return true for most group/sub-board/library/directory names.

    Most strings configured in in SCFG contain just US-ASCII characters, which makes them also valid UTF-8 strings.

  • I had the impression that those don't have UTF-8 characters

    ASCII characters are UTF-8 characters.

  • Rob Swindell mentioned in commit 654b6f76

    mentioned in commit 654b6f76

Please register or sign in to reply
Loading