On Wednesday 24 May 2006 19:23, JG wrote:
> i can confirm that too (and i've been having this for quite some time
> now, always on SVN), it seems to be on a random basis when i'm sending
> messages with umlauts. i get "error encoding to UTF-16 from "
> - and no text after the from anymore.
Changing line 105 in icqd-tcp.cpp to
if (u && u->UserEncoding() && strcmp("", u->UserEncoding()) != 0)
(added the strcmp-part) fixed this. Confirmed by JG^ in #licq.
The attached patch should fix the problem in a better way, but is so far
untested. Observe that this is proably not the same bug as the one that
started this thread.
The problem was that ICQUser::UserEncoding() returned "", which iconv_open
accepted as a valid encoding, but later failed on when doing the conversion.
// Erik
--
All programmers are optimists.
-- Frederick P. Brooks, Jr.
Erik Johansson
http://ejohansson.se
=== translate.cpp
==================================================================
--- translate.cpp (revision 4211)
+++ translate.cpp (local)
@@ -418,7 +418,10 @@
}
szFrom[j] = '\0';
- tr = iconv_open("UCS-2BE", szFrom);
+ if (j > 0) // only use szFrom if it actually contains something
+ tr = iconv_open("UCS-2BE", szFrom);
+ else
+ tr = iconv_open("UCS_2BE", "UTF-8");
if (tr != (iconv_t)-1)
{
size_t ret = iconv(tr, (ICONV_CONST char**)&szIn, &nInSize, &szOut, &nOutSize);