| Summary: | Messy text with UTF-8(desktop) and GBK(Palm) | ||
|---|---|---|---|
| Product: | [Unmaintained] kpilot | Reporter: | Kun Xi <bookstack> |
| Component: | General | Assignee: | groot |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | vR |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Gentoo Packages | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
On Wednesday 29 November 2006 22:24, Kun Xi wrote:
> The problem exists in the KAddressbook sync with Palm's Contacts. In Palm,
> the Chinese character is encoded in GBK, while the Linux box take the
> en_US.UTF8 as the locale. After the synchronization, the Palm's contact is
> synced with messed text.
Thank you for the patch. I have applied something similar to KPilot's SVN, and
that will be merged to KPilot in KDE SVN for KDE 3.5.6.
Excellent news. A fixed bug! =:) Thank you for the bug report!! Also, I'd really appreciate your help in testing out KPilot from the really-soon-to-be-released KDE 4.2!!! =:) |
Version: 4.6.0 (using KDE KDE 3.5.5) Installed from: Gentoo Packages Compiler: gcc-4.1.1 OS: Linux Desktop: Gentoo Linux, KDE 3.5.5, everything is built via ebuild, GCC 4.1.1 Handheld: Palm Tungsten T The problem exists in the KAddressbook sync with Palm's Contacts. In Palm, the Chinese character is encoded in GBK, while the Linux box take the en_US.UTF8 as the locale. After the synchronization, the Palm's contact is synced with messed text. I dig into the problem, and find the bug in pilotAddress.cc, Here is the patch for kdepim-3.5.4 package, this bug also resides in the svn HEADER: diff -ur kdepim-3.5.4.orig/kpilot/lib/pilotAddress.cc kdepim-3.5.4/kpilot/lib/pilotAddress.cc --- kdepim-3.5.4.orig/kpilot/lib/pilotAddress.cc 2006-11-21 16:01:54.486213888 -0500 +++ kdepim-3.5.4/kpilot/lib/pilotAddress.cc 2006-11-21 16:03:10.937591512 -0500 @@ -692,8 +692,9 @@ } if (!text.isEmpty()) { - fAddressInfo.entry[field] = (char *) malloc(text.length() + 1); - strlcpy(fAddressInfo.entry[field], codec()->fromUnicode(text), text.length() + 1); + QCString locale = codec()->fromUnicode(text); + fAddressInfo.entry[field] = (char *) malloc(locale.length() + 1); + strlcpy(fAddressInfo.entry[field], locale, locale.length() + 1); } else { The problem here is the length of gbk string is not equal utf8 string.