From 10919035c864c1fe463ba0547c7a321c6bf8520e Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 22 May 2011 21:21:01 +0000 Subject: [PATCH] PlainTextCatalog::WriteToFile(): Escape characters in the comment string. Hopefully undoes the string changes seen on HTA since r41629. Note that the asymmetric escaping/unescaping (PlainTextCatalog::WriteToFile() vs. BHashMapCatalog::SetString()) is rather broken and needs to be fixed. +alpha I guess. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41667 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/locale/catalogs/plaintext/Catalog.cpp | 7 ++++++- src/tools/locale/PlainTextCatalog.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/add-ons/locale/catalogs/plaintext/Catalog.cpp b/src/add-ons/locale/catalogs/plaintext/Catalog.cpp index b09b8f6c9d..646ff354af 100644 --- a/src/add-ons/locale/catalogs/plaintext/Catalog.cpp +++ b/src/add-ons/locale/catalogs/plaintext/Catalog.cpp @@ -319,18 +319,23 @@ PlainTextCatalog::WriteToFile(const char *path) CatMap::Iterator iter = fCatMap.GetIterator(); CatMap::Entry entry; BString original; + BString comment; BString translated; while (iter.HasNext()) { entry = iter.Next(); original = entry.key.fString; + comment = entry.key.fComment; translated = entry.value; + escapeQuotedChars(original); + escapeQuotedChars(comment); escapeQuotedChars(translated); + textContent.Truncate(0); textContent << original.String() << "\t" << entry.key.fContext.String() << "\t" - << entry.key.fComment.String() << "\t" + << comment << "\t" << translated.String() << "\n"; res = catalogFile.Write(textContent.String(),textContent.Length()); if (res != textContent.Length()) diff --git a/src/tools/locale/PlainTextCatalog.cpp b/src/tools/locale/PlainTextCatalog.cpp index 43d87128f0..71e35bb3f9 100644 --- a/src/tools/locale/PlainTextCatalog.cpp +++ b/src/tools/locale/PlainTextCatalog.cpp @@ -275,18 +275,23 @@ PlainTextCatalog::WriteToFile(const char *path) CatMap::Iterator iter = fCatMap.GetIterator(); CatMap::Entry entry; BString original; + BString comment; BString translated; while (iter.HasNext()) { entry = iter.Next(); original = entry.key.fString; + comment = entry.key.fComment; translated = entry.value; + escapeQuotedChars(original); + escapeQuotedChars(comment); escapeQuotedChars(translated); + textContent.Truncate(0); textContent << original.String() << "\t" << entry.key.fContext.String() << "\t" - << entry.key.fComment.String() << "\t" + << comment << "\t" << translated.String() << "\n"; res = catalogFile.Write(textContent.String(),textContent.Length()); if (res != textContent.Length())