commit 3706d959b657b53dd094a75ac336e24a8f1739b2 Author: Tanmai Khanna Date: Wed Aug 26 13:17:36 2020 +0530 Fix escaping with wblanks diff --git a/lttoolbox/fst_processor.cc b/lttoolbox/fst_processor.cc index 1dc7c37..05a5dcd 100644 --- a/lttoolbox/fst_processor.cc +++ b/lttoolbox/fst_processor.cc @@ -288,8 +288,7 @@ FSTProcessor::wblankPostGen(FILE *input, FILE *output) if(c == L'\\') { - result += c; - result += static_cast(fgetwc_unlocked(input)); + result += static_cast(readEscaped(input)); } else if(c == L']') { diff --git a/tests/lt_proc/__init__.py b/tests/lt_proc/__init__.py index a4e0709..9e8db46 100644 --- a/tests/lt_proc/__init__.py +++ b/tests/lt_proc/__init__.py @@ -193,5 +193,13 @@ class PostgenerationWordboundBlankTest(unittest.TestCase, ProcTest): "[[t:b:Z9eiLA]]abc[[/]] [[t:i:123456]]les pes test[[/]] [[t:i:4_tPUA; t:b:Z9eiLA]]del[[/]] [[t:i:wSM6RQ]]testword[[/]]", "[[t:b:Z9eiLA]]abc[[/]] [[t:i:123456; t:b:12bsa23]]les pes test[[/]] [[t:i:4_tPUA; t:b:Z9eiLA]]del[[/]] [[t:i:wSM6RQ]]testword[[/]]", "[[t:b:Z9eiLA]]abc[[/]] [[t:b:12bsa23]]les pes test[[/]] [[t:i:4_tPUA; t:b:Z9eiLA]]del[[/]] [[t:i:wSM6RQ]]testword[[/]]"] + +class PostgenerationWordboundBlankEscapingTest(unittest.TestCase, ProcTest): + procdix = "data/postgen.dix" + procflags = ["-p", "-z"] + inputs = [ "Systran ([[t:a:PJD9GA]]http:\/\/www.systran.de\/[[/]]).[] Systran (http:\/\/www.systran.de\/).[]"] + + expectedOutputs = [ "Systran ([[t:a:PJD9GA]]http:\/\/www.systran.de\/[[/]]).[] Systran (http:\/\/www.systran.de\/).[]" ] + # These fail on some systems: #from null_flush_invalid_stream_format import *