LT tests fail on Windows (English module for LanguageTool)

Hello dear users,
I have received error below when trying to make a clean test. This happened in v6.1-1251-ga36cf6584c newest version on github.
[ERROR] Errors:
[ERROR] EnglishPatternRuleTest>PatternRuleTest.lambda$testGrammarRulesFromXML$2:533->PatternRuleTest.testCorrectSentences:819->PatternRuleTest.addError:499 ┬╗ PatternRuleTestFailure Test failure for rule UNIT_SPACE[1] in file /org/languagetool/rules/en/grammar.xml (line -1): Did not expect error in:
…their sample variance, and ¤â2N their population variance.
Analyzed token readings: [/SENT_START*] .[./.,./PCT] .[./.,./PCT] .[./.,./PCT] their[they/PRP$_A3S*,they/PRP$_A3P*,their/PRP$] [ /null] sample[sample/JJ,I-NP-singular] [ /null*] va
riance[variance/NN:UN,E-NP-singular] ,[,/,,/PCT,O] [ /null*] and[and/CC,O] [ /null*] ¤â2N[¤â2N/null,B-PP] [ /null*] their[they/PRP$_A3S,they/PRP$_A3P,their/PRP$,B-NP-singular] [ /null*] population[population/NN:UN,I-NP-singular] [ /null*] variance[variance/NN:UN,E-NP-singular] .[./.,./SENT_END,./PCT*,O]

[INFO]
[ERROR] Tests run: 114, Failures: 0, Errors: 1, Skipped: 9

java version “19.0.2” 2023-01-17
Java™ SE Runtime Environment (build 19.0.2+7-44)

Any suggestions? I would be greateful for any help.

This looks like an encoding issue specific to Windows. Does it help if you add -Dfile.encoding=UTF-8 to the command you call?

I had the same issue, and it still occurs after fixing all of the encoding issues (installing PowerShell7, enabling system-wide UTF8 support in Language settings).

It looks like the UNIT_SPACE regex incorrectly triggers on the string σ2N because the regex uses ? before the SI abbreviations when checking N (Newtons). Removing the ? (Z|E|P|T|G|M|k|h|da|d|c|m|µ|n|p|f|a|z|y)?N fixed the error for me.

You also have to change the 15N example to remove the type="triggers_error".

I am not sure why this test doesn’t fail normally though.

(I have not checked whether this works properly, so I haven’t done anything on Github.)