** General Description **
It seems that the test mentioned in the subject has been amended subsequently to an effort of making the Slim protocol tests work on Windows (#1477)
The change was brought to the test, and states "Surrogate Length is different depending on OS". The change has been accepted into the codebase. Why so ?
In SLiM, the strings must be prefixed by their length as "The six+ digits are the number of UTF-16 code units in the string", that's what the doc says at https://fitnesse.org/FitNesse/UserGuide/WritingAcceptanceTests/SliM/SlimProtocol.html
The source file is encoded in UTF-8, and the supplementary character of the test is spliced directly into the string literal as F0 9F 80 9C twice, so correctly UTF-8 encoded. I suspect the real issue on Windows was because the compiler misinterpreted the string as being 8 windows-1252 characters instead of 5 UTF-8-encoded characters. I believe the correct fix for the test to be charset-independent would have been to replace the supplementary character by its correct escape sequence, namely \uD83C\uDC1C. (The actual surrogate pair)
Does anyone agree with my analysis ?
** General Description **
It seems that the test mentioned in the subject has been amended subsequently to an effort of making the Slim protocol tests work on Windows (#1477)
The change was brought to the test, and states "Surrogate Length is different depending on OS". The change has been accepted into the codebase. Why so ?
chars." (https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html)chars in aString" (https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Character.html#unicode)lengthwill count the number onchars used (code units), not the number of codepoints." (https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#length--)In SLiM, the strings must be prefixed by their
lengthas "The six+ digits are the number of UTF-16 code units in the string", that's what the doc says at https://fitnesse.org/FitNesse/UserGuide/WritingAcceptanceTests/SliM/SlimProtocol.htmlThe source file is encoded in UTF-8, and the supplementary character of the test is spliced directly into the string literal as
F0 9F 80 9Ctwice, so correctly UTF-8 encoded. I suspect the real issue on Windows was because the compiler misinterpreted the string as being 8windows-1252characters instead of 5 UTF-8-encoded characters. I believe the correct fix for the test to be charset-independent would have been to replace the supplementary character by its correct escape sequence, namely\uD83C\uDC1C. (The actual surrogate pair)Does anyone agree with my analysis ?