Diagnosis of KPilot/Palm’s messy text
Desktop, Gentoo November 29th, 2006
It is a pain of ass that Palm does not support Unicode, definitely a big design flaw. It is also a pity that CJKOS would not support the Unicode either, we lost the last chance to patch the system by third party hack. I have to use the GBK encoding in Palm before the legendary PalmOS Garnet or Access Linux Platform available. Unfortunately, the KPilot fails to synchronize the name of the contacts from the KAddressbook, for example, é’Ÿç« çŽ¯ becomes ç« &, ^. It is quite curious that part of the string is encoded correctly. Later, I dig into the code, and found this code snippet:
{
fAddressInfo.entry[field] = (char *) malloc(text.length() + 1);
strlcpy(fAddressInfo.entry[field], codec()->fromUnicode(text), text.length() + 1);
}
The bug results in that the length of the UTF8 encoded string is not the same as the GBK encoded string. A workaround is like this:
{
QCString locale = codec()->fromUnicode(text);
fAddressInfo.entry[field] = (char *) malloc(locale.length() + 1);
strlcpy(fAddressInfo.entry[field], locale, locale.length() + 1);
}
It has been submitted to the KDE Bugzilla, Bug 138108.







[...] developers have released 3.5.6, and claimed that it has solved lots of long-lasting bug, including my patch as well. However, the KPilot 3.5.6 depends on >=pilot-link-12.0, while pilot-link is buggy for the [...]