diff options
Diffstat (limited to 'tools/aapt/pseudolocalize.cpp')
-rw-r--r-- | tools/aapt/pseudolocalize.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/aapt/pseudolocalize.cpp b/tools/aapt/pseudolocalize.cpp index c7fee2c19342..5c47e0fa8a16 100644 --- a/tools/aapt/pseudolocalize.cpp +++ b/tools/aapt/pseudolocalize.cpp @@ -360,9 +360,15 @@ String16 PseudoMethodBidi::text(const String16& source) String16 result; bool lastspace = true; bool space = true; + bool escape = false; + const char16_t ESCAPE_CHAR = '\\'; for (size_t i=0; i<source.size(); i++) { char16_t c = s[i]; - space = is_space(c); + if (!escape && c == ESCAPE_CHAR) { + escape = true; + continue; + } + space = (!escape && is_space(c)) || (escape && (c == 'n' || c == 't')); if (lastspace && !space) { // Word start result += k_rlm + k_rlo; @@ -371,6 +377,10 @@ String16 PseudoMethodBidi::text(const String16& source) result += k_pdf + k_rlm; } lastspace = space; + if (escape) { + result.append(&ESCAPE_CHAR, 1); + escape=false; + } result.append(&c, 1); } if (!lastspace) { |