Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-6878

Inline search check for non-latin characters treats Vietnamese characters as non-latin

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2013-11-11
    • None
    • Search
    • None

      Since Javascript doesn't have something cool like \p

      {Latin}

      , we have to do a range to catch latin characters and decide whether to show the sortname/localised name.

      I did make a fix for this a while ago, but never put a branch up. Since it doesn't seem like I'm going to get round to it any time soon, the change I made was to change MB.utility.is_ascii in root/static/scripts/common/MB/utility.js from

      MB.utility.is_ascii = function (str) { return ! /[^\u0000-\u00ff]/.test(str); };
      

      to

      MB.utility.is_ascii = function (str) { return ! /[^\u0000-\u02ff\u1E00-\u1EFF\u2000-\u207F]/.test(str); };
      

      That adds all the latin blocks at the beginning of Unicode (which covers almost all latin characters in common usage), the block with Vietnamese characters and the block with the most common Unicode punctuation we use.

      Also, it would make sense to change the function name from "is_ascii" to "is_latin", since we're not just checking for ASCII. Last time I looked, the inline search was the only place using that function.

            acid2 Oliver Charles
            nikki nikki
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                2013-11-11