Hi, I just wanted to share this piece of code with you:
it will assume that every pre-roster and non-utf8 filename is actually latin1 encoded and fix it. Useful if rosterify gives you errors about non-utf-8-file names. Christof ============================================================ --- legacy.cc 6867f219f457fa5df90b2801871c1e1f61a451f0 +++ legacy.cc 7c636d8554d63f2c79dbcc497d3b821130d73ef8 @@ -11,6 +11,7 @@ #include "basic_io.hh" #include "app_state.hh" #include "constants.hh" +#include "charset.hh" using std::make_pair; using std::string; @@ -163,6 +164,21 @@ namespace legacy file_name = dat().substr(file_name_begin); else file_name = dat().substr(file_name_begin, pos - file_name_begin); + if (!utf8_validate(file_name)) + { + // assume latin1 + std::string tmp; + for (std::string::const_iterator i=file_name.begin();i!=file_name.end();++i) + { + if ((*i&0x80)) + { + tmp+=0xc0|((*i>>6)&3); + tmp+=0x80|(*i&0x3c); + } + else tmp+=*i; + } + file_name=tmp; + } man.insert(make_pair(file_path_internal(file_name), hexenc<id>(ident))); // skip past the '\n' ============================================================
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Monotone-devel mailing list Monotone-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/monotone-devel