Univention Bugzilla – Attachment 2379 Details for
Bug 16637
Encoding-Traceback in UCR wenn nicht UTF-8 Zeichen in base.conf stehen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Force utf-8 encoding
force-utf8.patch (text/plain), 1.05 KB, created by
Andreas Büsching
on 2010-04-12 11:04:08 CEST
(
hide
)
Description:
Force utf-8 encoding
Filename:
MIME Type:
Creator:
Andreas Büsching
Created:
2010-04-12 11:04:08 CEST
Size:
1.05 KB
patch
obsolete
>Index: python/univention/config_registry.py >=================================================================== >--- python/univention/config_registry.py (Revision 16054) >+++ python/univention/config_registry.py (Arbeitskopie) >@@ -239,10 +239,15 @@ > > key, value = line.split(': ', 1) > value = value.strip() >- if len(value) == 0: #if variable was set without an value >- value = '' >+ # check encoding >+ try: >+ utf8_value = value.decode() >+ except UnicodeDecodeError: >+ utf8_value = value.decode( 'latin1' ) >+ if len(utf8_value) == 0: #if variable was set without an value >+ utf8_value = '' > >- self[key] = value >+ self[key] = utf8_value > fp.close() > > if import_failed: >@@ -293,6 +298,14 @@ > except KeyError: > return '' > >+ def __setitem__( self, key, value ): >+ try: >+ utf8_value = value.decode() >+ except UnicodeDecodeError: >+ utf8_value = value.decode( 'latin1' ) >+ >+ return dict.__setitem__( self, key, utf8_value ) >+ > def removeInvalidChars (self, seq): > for letter in invalid_value_chars: > seq = seq.replace(letter,'')
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 16637
: 2379