mbeckerle commented on a change in pull request #260: Adds support for
non-spacing and combining chars
URL: https://github.com/apache/incubator-daffodil/pull/260#discussion_r301872132
##########
File path: daffodil-io/src/main/scala/org/apache/daffodil/io/Dump.scala
##########
@@ -516,24 +544,41 @@ class DataDumper {
// Either way, we got our one character
Assert.invariant(nConsumedBytes > 0)
Assert.invariant(cb.hasArray)
- var allChars = cb.array
- remapped = if (allChars.length > 1) allChars.mkString else
Misc.remapCodepointToVisibleGlyph(allChars(0)).toChar.toString
- nCols = if (allChars.length > 1) {
- try {
- var uCodePoint = UCharacter.getCodePoint(allChars(0),
allChars(1))
- charNColumns(uCodePoint)
- } catch {
- case e: IllegalArgumentException => {
- allChars.mkString.length
+ val allChars = cb.array
+
+ val uCodePoint =
+ if (allChars.length > 1) {
+ try {
+ UCharacter.getCodePoint(allChars(0), allChars(1))
+ } catch {
+ case e: IllegalArgumentException => {
+ -1
Review comment:
Please add a comment to the -1 line indicating the specific purpose of this
-1. I think this means it is not a surrogate pair, so the getCodePoint function
can't convert the two 16-bit codes to a single char codepoint.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services