comparison src/common.cpp @ 411:d0ebd797c5a1

Ah, OK -- it seems we get escapes for backslashes generally, so handle that
author Chris Cannam
date Tue, 07 Jun 2011 11:00:16 +0100
parents 4f5414a7edb4
children 498c2ca0b367
comparison
equal deleted inserted replaced
410:4f5414a7edb4 411:d0ebd797c5a1
262 { 262 {
263 QString d; 263 QString d;
264 for (int i = 0; i < s.length(); ++i) { 264 for (int i = 0; i < s.length(); ++i) {
265 // backslash-u escaped with another backslash: replace with a 265 // backslash-u escaped with another backslash: replace with a
266 // single backslash and skip on 266 // single backslash and skip on
267 if (i+2 < s.length() && s[i] == '\\' && s[i+1] == '\\' && s[i+2] == 'u') { 267 if (i+1 < s.length() && s[i] == '\\' && s[i+1] == '\\') {
268 d += "\\u"; 268 d += '\\';
269 i += 2; 269 i += 1;
270 continue; 270 continue;
271 } 271 }
272 // unescaped backslash followed by u and at least four more 272 // unescaped backslash followed by u and at least four more
273 // chars: replace with Unicode character 273 // chars: replace with Unicode character
274 if (i+5 < s.length() && s[i] == '\\' && s[i+1] == 'u') { 274 if (i+5 < s.length() && s[i] == '\\' && s[i+1] == 'u') {