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
This commit is contained in:
Ingo Weinhold 2011-05-22 21:21:01 +00:00
parent f52172f64a
commit 10919035c8
2 changed files with 12 additions and 2 deletions

View File

@ -319,18 +319,23 @@ PlainTextCatalog::WriteToFile(const char *path)
CatMap::Iterator iter = fCatMap.GetIterator(); CatMap::Iterator iter = fCatMap.GetIterator();
CatMap::Entry entry; CatMap::Entry entry;
BString original; BString original;
BString comment;
BString translated; BString translated;
while (iter.HasNext()) { while (iter.HasNext()) {
entry = iter.Next(); entry = iter.Next();
original = entry.key.fString; original = entry.key.fString;
comment = entry.key.fComment;
translated = entry.value; translated = entry.value;
escapeQuotedChars(original); escapeQuotedChars(original);
escapeQuotedChars(comment);
escapeQuotedChars(translated); escapeQuotedChars(translated);
textContent.Truncate(0); textContent.Truncate(0);
textContent << original.String() << "\t" textContent << original.String() << "\t"
<< entry.key.fContext.String() << "\t" << entry.key.fContext.String() << "\t"
<< entry.key.fComment.String() << "\t" << comment << "\t"
<< translated.String() << "\n"; << translated.String() << "\n";
res = catalogFile.Write(textContent.String(),textContent.Length()); res = catalogFile.Write(textContent.String(),textContent.Length());
if (res != textContent.Length()) if (res != textContent.Length())

View File

@ -275,18 +275,23 @@ PlainTextCatalog::WriteToFile(const char *path)
CatMap::Iterator iter = fCatMap.GetIterator(); CatMap::Iterator iter = fCatMap.GetIterator();
CatMap::Entry entry; CatMap::Entry entry;
BString original; BString original;
BString comment;
BString translated; BString translated;
while (iter.HasNext()) { while (iter.HasNext()) {
entry = iter.Next(); entry = iter.Next();
original = entry.key.fString; original = entry.key.fString;
comment = entry.key.fComment;
translated = entry.value; translated = entry.value;
escapeQuotedChars(original); escapeQuotedChars(original);
escapeQuotedChars(comment);
escapeQuotedChars(translated); escapeQuotedChars(translated);
textContent.Truncate(0); textContent.Truncate(0);
textContent << original.String() << "\t" textContent << original.String() << "\t"
<< entry.key.fContext.String() << "\t" << entry.key.fContext.String() << "\t"
<< entry.key.fComment.String() << "\t" << comment << "\t"
<< translated.String() << "\n"; << translated.String() << "\n";
res = catalogFile.Write(textContent.String(),textContent.Length()); res = catalogFile.Write(textContent.String(),textContent.Length());
if (res != textContent.Length()) if (res != textContent.Length())