diff options
Diffstat (limited to 'fixes/taglib-fixes/taglib-1.4_wchar.diff')
-rw-r--r-- | fixes/taglib-fixes/taglib-1.4_wchar.diff | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/fixes/taglib-fixes/taglib-1.4_wchar.diff b/fixes/taglib-fixes/taglib-1.4_wchar.diff new file mode 100644 index 0000000..b84a614 --- /dev/null +++ b/fixes/taglib-fixes/taglib-1.4_wchar.diff @@ -0,0 +1,31 @@ +diff -ruN taglib-1.4.org/taglib/toolkit/tstring.cpp taglib-1.4/taglib/toolkit/tstring.cpp +--- taglib-1.4.org/taglib/toolkit/tstring.cpp 2005-07-26 06:31:15.000000000 +0900 ++++ taglib-1.4/taglib/toolkit/tstring.cpp 2006-05-26 12:02:55.000000000 +0900 +@@ -202,12 +202,22 @@ + s.resize(d->data.size()); + + if(!unicode) { +- std::string::iterator targetIt = s.begin(); +- for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) { +- *targetIt = char(*it); +- ++targetIt; ++ bool cjk = false; ++ //pre-scan: is there any cjk unicode character? if so, convert the string into utf-8. ++ for(unsigned int i=0; i< d->data.size(); i++){ ++ if(d->data[i] > 0xff){ ++ cjk = true; ++ break; ++ } ++ } ++ if(!cjk){ ++ std::string::iterator targetIt = s.begin(); ++ for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) { ++ *targetIt = char(*it); ++ ++targetIt; ++ } ++ return s; + } +- return s; + } + + const int outputBufferSize = d->data.size() * 3 + 1; |