Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
047f7ce2
Commit
047f7ce2
authored
19 years ago
by
dkirov
Browse files
Options
Downloads
Patches
Plain Diff
getpreferredencoding instead of utf-8
parent
6b615a8d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gajim-remote.py
+16
-14
16 additions, 14 deletions
src/gajim-remote.py
with
16 additions
and
14 deletions
src/gajim-remote.py
+
16
−
14
View file @
047f7ce2
...
...
@@ -43,11 +43,12 @@ from common import i18n
_
=
i18n
.
_
i18n
.
init
()
PREFERRED_ENCODING
=
locale
.
getpreferredencoding
()
def
send_error
(
error_message
):
'''
Writes error message to stderr and exits
'''
print
>>
sys
.
stderr
,
error_message
.
encode
(
locale
.
getpreferredencoding
())
sys
.
exit
()
'''
Writes error message to stderr and exits
'''
print
>>
sys
.
stderr
,
error_message
.
encode
(
PREFERRED_ENCODING
)
sys
.
exit
()
try
:
import
dbus
...
...
@@ -64,6 +65,7 @@ INTERFACE = 'org.gajim.dbus.RemoteInterface'
SERVICE
=
'
org.gajim.dbus
'
BASENAME
=
'
gajim-remote
'
class
GajimRemote
:
def
__init__
(
self
):
...
...
@@ -215,10 +217,9 @@ class GajimRemote:
self
.
command
=
sys
.
argv
[
1
]
if
self
.
command
==
'
help
'
:
if
self
.
argv_len
==
3
:
print
self
.
help_on_command
(
sys
.
argv
[
2
]).
encode
(
locale
.
getpreferredencoding
())
print
self
.
help_on_command
(
sys
.
argv
[
2
]).
encode
(
PREFERRED_ENCODING
)
else
:
print
self
.
compose_help
().
encode
(
locale
.
getpreferredencoding
()
)
print
self
.
compose_help
().
encode
(
PREFERRED_ENCODING
)
sys
.
exit
()
self
.
init_connection
()
...
...
@@ -385,7 +386,7 @@ class GajimRemote:
res
+=
self
.
print_info
(
level
+
1
,
items
)
if
res
!=
''
:
if
isinstance
(
res
,
str
):
res
=
res
.
decode
(
'
utf-8
'
)
res
=
res
.
decode
(
PREFERRED_ENCODING
)
ret_str
+=
'
%s%s:
\n
%s
'
%
(
spacing
,
key
,
res
)
elif
isinstance
(
val
,
dict
):
res
=
self
.
print_info
(
level
+
1
,
val
)
...
...
@@ -395,8 +396,8 @@ class GajimRemote:
# utf-8 string come from gajim
# FIXME: why we have strings instead of unicode?
if
isinstance
(
ret_str
,
str
):
ret
_str
=
ret_str
.
decode
(
'
utf-8
'
)
return
ret_str
.
encode
(
locale
.
getpreferredencoding
()
)
ret
urn
ret_str
return
ret_str
.
encode
(
PREFERRED_ENCODING
)
def
unrepr
(
self
,
serialized_data
):
'''
works the same as eval, but only for structural values,
...
...
@@ -490,9 +491,9 @@ class GajimRemote:
send_error
(
'
Wrong string: %s
'
%
(
value
))
val
,
next
=
self
.
unrepr
(
next
[
1
:])
if
isinstance
(
key
,
str
):
key
=
key
.
decode
(
'
utf-8
'
)
key
=
key
.
decode
(
PREFERRED_ENCODING
)
if
isinstance
(
val
,
str
):
val
=
val
.
decode
(
'
utf-8
'
)
val
=
val
.
decode
(
PREFERRED_ENCODING
)
_dict
[
key
]
=
val
next
=
next
.
strip
()
if
not
next
:
...
...
@@ -551,8 +552,9 @@ class GajimRemote:
args
=
self
.
commands
[
self
.
command
][
1
]
if
len
(
args
)
>
argv_len
:
if
args
[
argv_len
][
2
]:
send_error
(
_
(
'
Argument
"
%s
"
is not specified.
\n\
Type
"
%s help %s
"
for more info
'
)
%
(
args
[
argv_len
][
0
],
BASENAME
,
self
.
command
))
send_error
(
_
(
'
Argument
"
%s
"
is not specified.
\n
'
'
Type
"
%s help %s
"
for more info
'
)
%
(
args
[
argv_len
][
0
],
BASENAME
,
self
.
command
))
def
gobject_quit
(
self
):
if
_version
[
1
]
>=
41
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment