summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceUtils.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2018-10-03 09:20:57 -0700
committerRyan Mitchell <rtmitchell@google.com>2018-10-03 11:35:37 -0700
commit0ce89734d111ce3a9529254ccc9b8ef33fdeba73 (patch)
tree94536a693f37675e6f662746c951c9227c4069c8 /tools/aapt2/ResourceUtils.cpp
parent88f0f6c9b1d2dfecd4f0bdb663f01a098a59fa83 (diff)
Fix failing Windows tests
Some tests were not written to run on Windows correctly. Compile also has a bug that caused using the --zip flag to fail on Windows. iswspace does count the non breaking space as Whiespace on Windows but not on Unix based systems Bug: 117156986 Change-Id: I999375162bdfdf86fb25992ee88e2962ab90b577 Test: aapt2_tests and wine aapt2_tests.exe
Diffstat (limited to 'tools/aapt2/ResourceUtils.cpp')
-rw-r--r--tools/aapt2/ResourceUtils.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp
index c48765b7b947..de00fcaea07b 100644
--- a/tools/aapt2/ResourceUtils.cpp
+++ b/tools/aapt2/ResourceUtils.cpp
@@ -38,6 +38,8 @@ using ::android::base::StringPrintf;
namespace aapt {
namespace ResourceUtils {
+constexpr int32_t kNonBreakingSpace = 0xa0;
+
Maybe<ResourceName> ToResourceName(
const android::ResTable::resource_name& name_in) {
ResourceName name_out;
@@ -810,7 +812,7 @@ StringBuilder& StringBuilder::AppendText(const std::string& text, bool preserve_
Utf8Iterator iter(text);
while (iter.HasNext()) {
char32_t codepoint = iter.Next();
- if (!preserve_spaces && !quote_ && iswspace(codepoint)) {
+ if (!preserve_spaces && !quote_ && codepoint != kNonBreakingSpace && iswspace(codepoint)) {
if (!last_codepoint_was_space_) {
// Emit a space if it's the first.
xml_string_.text += ' ';