New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Character.digit is too restrictive in what it considers digits #1189
Comments
Thanks for the bug report! |
As a fellow user of ScalaNative, thank you for reporting this problem. TLDR;Looks like PR #651 dated April 21, 2017 (the 2017 looks suspicious!) If you are no longer experiencing this problem, I believe this issue can Long Story:You carefully documented report was incredibly helpful. CharacterSuite.scala has no relevant tests. When I could not replicate the reported issue using one arbitrarily chosen digit in the I took the list off ranges you documented and wrote a program to I tested first using Java 10, then Java 8, the current S-N support standard. Looks fixed to me. Please advise. Thank you. Lee |
The bug is still there, but the title is wrong (the issue is with digit, as in the description, not with isDigit as in the title) See: https://scastie.scala-lang.org/nlxWbwbyQumeFTzJGRxfPw The native digit method there is lifted from https://github.com/scala-native/scala-native/blob/master/javalib/src/main/scala/java/lang/Character.scala#L1152-L1168 |
We recently fixed |
@sjrd Thanks for the heads up! 👍 |
…considers digits" * The presenting problem was expressed in issue scala-native#1189 "Character.digit is too restrictive in what it considers digits " This issue is now fixed. ScalaNative now can correctly categorize digits from additional Unicode 16 bit blocks. * The code in this pull request is ported, with gratitude and minor modifications, from ScalaJS, especially ScalaJS commit: https://github.com/scala-js/scala-js/commit/ 396ff7287d06a7690ac12ed906b878e377fba91d Thank you, @sjrd, for both permission to use the code and, especially, notification that it existed. * The prior code had been missing a Java 8 method `def digit(codePoint: Int, radix: Int): Int`. That method has now been ported. * The ScalaJs digit test case was added, with minor modifications to avoid naming conflicts, to CharacterSuite.scala. 64/32 bit issues: None known. Documentation: Deserves a release note. Testing: * Built and tested ("test-all") on X86_64. All tests passed.
…considers digits" * The presenting problem was expressed in issue scala-native#1189 "Character.digit is too restrictive in what it considers digits " This issue is now fixed. ScalaNative now can correctly categorize digits from additional Unicode 16 bit blocks. * The code in this pull request is ported, with gratitude and minor modifications, from ScalaJS, especially ScalaJS commit: https://github.com/scala-js/scala-js/commit/ 396ff7287d06a7690ac12ed906b878e377fba91d Thank you, @sjrd, for both permission to use the code and, especially, notification that it existed. * An unexpected but welcome consequence of this PR is that j.l.Integer.parseInt, j.l.Integer.parseUnsignedInt, j.l.Long.parseLong, and j.l.Long.parseUnsignedLong now handle Unicode digits. I also checked that at least j.l.Integer.parseInt rejected, as it should, Unicode supplementary characters, even if Character.digit reports them as digits. ScalaJs PR "Fix scala-native#2935: Support non-ASCII scripts in `parseInt` and `parseLong`." appears to be unneeded in S-N. * The prior code had been missing a Java 8 method `def digit(codePoint: Int, radix: Int): Int`. That method has now been ported. * The ScalaJs digit test case was added, with minor modifications to avoid naming conflicts, to CharacterSuite.scala. 64/32 bit issues: None known. Documentation: Deserves a release note. Testing: * Built and tested ("test-all") on X86_64. All tests passed.
@sjrd Thank you for the information about the Scala.js Character.digit fix. You saved me days if not @martijnhoekstra PR #1333 is in the queue. Let me know if that solves |
…considers digits" * The presenting problem was expressed in issue scala-native#1189 "Character.digit is too restrictive in what it considers digits " This issue is now fixed. ScalaNative now can correctly categorize digits from additional Unicode 16 bit blocks. * The code in this pull request is ported, with gratitude and minor modifications, from ScalaJS, especially ScalaJS commit: https://github.com/scala-js/scala-js/commit/ 396ff7287d06a7690ac12ed906b878e377fba91d Thank you, @sjrd, for both permission to use the code and, especially, notification that it existed. * The prior code had been missing a Java 8 method `def digit(codePoint: Int, radix: Int): Int`. That method has now been ported. * An unexpected but welcome consequence of this PR is that extended Unicode strings are now supported by j.l.Integer.parseInt, j.l.Integer.parseUnsignedInt, j.l.Long.parseLong, & j.l.Long.parseUnsignedLong. I also checked that at least j.l.Integer.parseInt rejected, as it should, Unicode supplemental characters, even though they might be reported as digits by Character.digit. I was prompted to explore the parse* methods parsing Unicode by a ScalaJs commit to Character.scala after the Character.digit commit I was porting. It appears that ScalaJs change is not needed by ScalaNative. * The ScalaJs digit test case was added, with minor modifications to avoid naming conflicts, to CharacterSuite.scala. 64/32 bit issues: None known. Documentation: Deserves a release note. Testing: * Built and tested ("test-all") on X86_64. All tests passed.
…considers digits" * The presenting problem was expressed in issue scala-native#1189 "Character.digit is too restrictive in what it considers digits " This issue is now fixed. ScalaNative now can correctly categorize digits from additional Unicode 16 bit blocks. * The code in this pull request is ported, with gratitude and minor modifications, from ScalaJS, especially ScalaJS commit: https://github.com/scala-js/scala-js/commit/ 396ff7287d06a7690ac12ed906b878e377fba91d Thank you, @sjrd, for both permission to use the code and, especially, notification that it existed. * The prior code had been missing a Java 8 method `def digit(codePoint: Int, radix: Int): Int`. That method has now been ported. * An unexpected but welcome consequence of this PR is that extended Unicode strings are now supported by j.l.Integer.parseInt, j.l.Integer.parseUnsignedInt, j.l.Long.parseLong, & j.l.Long.parseUnsignedLong. I also checked that at least j.l.Integer.parseInt rejected, as it should, Unicode supplemental characters, even though they might be reported as digits by Character.digit. I was prompted to explore the parse* methods parsing Unicode by a ScalaJs commit to Character.scala after the Character.digit commit I was porting. It appears that ScalaJs change is not needed by ScalaNative. * The ScalaJs digit test case was added, with minor modifications to avoid naming conflicts, to CharacterSuite.scala. 64/32 bit issues: None known. Documentation: Deserves a release note. Testing: * Built and tested ("test-all") on X86_64. All tests passed.
…gits (#1333) * The presenting problem was expressed in issue #1189 "Character.digit is too restrictive in what it considers digits " This issue is now fixed. ScalaNative now can correctly categorize digits from additional Unicode 16 bit blocks. * The code in this pull request is ported, with gratitude and minor modifications, from ScalaJS, especially ScalaJS commit: https://github.com/scala-js/scala-js/commit/ 396ff7287d06a7690ac12ed906b878e377fba91d Thank you, @sjrd, for both permission to use the code and, especially, notification that it existed. * The prior code had been missing a Java 8 method `def digit(codePoint: Int, radix: Int): Int`. That method has now been ported. * An unexpected but welcome consequence of this PR is that extended Unicode strings are now supported by j.l.Integer.parseInt, j.l.Integer.parseUnsignedInt, j.l.Long.parseLong, & j.l.Long.parseUnsignedLong. I also checked that at least j.l.Integer.parseInt rejected, as it should, Unicode supplemental characters, even though they might be reported as digits by Character.digit. I was prompted to explore the parse* methods parsing Unicode by a ScalaJs commit to Character.scala after the Character.digit commit I was porting. It appears that ScalaJs change is not needed by ScalaNative. * The ScalaJs digit test case was added, with minor modifications to avoid naming conflicts, to CharacterSuite.scala. 64/32 bit issues: None known. Documentation: Deserves a release note. Testing: * Built and tested ("test-all") on X86_64. All tests passed.
…considers digits (scala-native#1333) * The presenting problem was expressed in issue scala-native#1189 "Character.digit is too restrictive in what it considers digits " This issue is now fixed. ScalaNative now can correctly categorize digits from additional Unicode 16 bit blocks. * The code in this pull request is ported, with gratitude and minor modifications, from ScalaJS, especially ScalaJS commit: https://github.com/scala-js/scala-js/commit/ 396ff7287d06a7690ac12ed906b878e377fba91d Thank you, @sjrd, for both permission to use the code and, especially, notification that it existed. * The prior code had been missing a Java 8 method `def digit(codePoint: Int, radix: Int): Int`. That method has now been ported. * An unexpected but welcome consequence of this PR is that extended Unicode strings are now supported by j.l.Integer.parseInt, j.l.Integer.parseUnsignedInt, j.l.Long.parseLong, & j.l.Long.parseUnsignedLong. I also checked that at least j.l.Integer.parseInt rejected, as it should, Unicode supplemental characters, even though they might be reported as digits by Character.digit. I was prompted to explore the parse* methods parsing Unicode by a ScalaJs commit to Character.scala after the Character.digit commit I was porting. It appears that ScalaJs change is not needed by ScalaNative. * The ScalaJs digit test case was added, with minor modifications to avoid naming conflicts, to CharacterSuite.scala. 64/32 bit issues: None known. Documentation: Deserves a release note. Testing: * Built and tested ("test-all") on X86_64. All tests passed.
The scala native implementation of Character.digit excludes the following digit ranges that OpenJDK does consider digits:
The text was updated successfully, but these errors were encountered: