[Kde-bindings] [Bug 105084] Python DCOP query issues with non-ASCII characters
Christian Folkers
DarkCutler at web.de
Mon Nov 6 14:17:17 UTC 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=105084
------- Additional Comments From DarkCutler web de 2006-11-06 15:17 -------
hmm ok i think i have found the problem (and solved it ;) )
my system:
fedora core 6(x86_64)
kdebindings-3.5.5-0.1.fc6
it is not related to pydcop.py (which is only a small wrapper around pcop.so)
it is a bug in the marshal modul of pcop.so
kdebindings-3.5.5/dcoppython/shell/marshal_funcs.data
around line 250
there is the conversion spec for QString which looks like:
type:QString
%doc as str s
%% marshal
{
if (!PyString_Check(obj)) return false;
if (str) {
QString s( PyString_AsString(obj) ); //<<<---bug---<<<<
(*str) << s;
}
return true;
}
%% demarshal
{
QString s;
(*str) >> s;
return PyString_FromString( s.utf8().data() );
}
%%
at line 250 the function uses the default constructor of QString
which expects a Latin-1 char* string
"""The encoding is assumed to be Latin-1, unless you change it using QTextCodec::setCodecForCStrings().""" <from qt docs>
i think a simple change in
QString s = QString::fromUtf8( PyString_AsString(obj) );
should be ok
here my suggestion:
type:QString
%doc as str s
%% marshal
{
if (!PyString_Check(obj)) return false;
if (str) {
QString s = QString::fromUtf8( PyString_AsString(obj) );
(*str) << s;
}
return true;
}
%% demarshal
{
QString s;
(*str) >> s;
return PyString_FromString( s.utf8().data() );
}
%%
More information about the Kde-bindings
mailing list