Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1729

NumberUtils.isParsable() returns true for Fullwidth Unicode digits

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.14.0
    • None
    • lang.math.*
    • None

    Description

      NumberUtils.isParsable() returns true for Fullwidth Unicode digits (U+FF10 to U+FF19, see https://en.wikipedia.org/wiki/Halfwidth_and_Fullwidth_Forms_(Unicode_block)), even though these cannot be parsed by Double.parseDouble() and Float.parseFloat(), asĀ NumberFormatExceptions are thrown when trying to parse these.

      I've also opened a JDK bug, see https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8326627 and https://bugs.openjdk.org/projects/JDK/issues/JDK-8326627

      Since the underlying issue is that Character.isDigit() returns true for fullwidth digits and until this is fixed in the JDK, it would be great to fix this in NumberUtils.isParsable() so that it would return false for Fullwidth Unicode digits.

      Gist reproducing the issue: https://gist.github.com/XDex/2e300189a07e8224524100f26b5f6b46

      Attachments

        Activity

          People

            Unassigned Unassigned
            xdex Andrei Anischevici
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: