Menu

Commit [r3114]  Maximize  Restore  History

unicode fixes for TracAdmin

There were several problems left:
1. TracAdmin was still using UTF-8 encoded strings rather than `unicode` strings
2. but `shlex` is not unicode aware, so `arg_tokenize()` works around this limitation by going through UTF-8 locally
3. When converting a `str` command to `unicode` in the main entry point (`onecmd()`), we use the `sys.stdin.encoding`.
4. When converting `unicode` strings to output, we conversely use `sys.stdout.encoding`
5. Added an unit test for a creating Milestone with an accented character

3. and 4. replace the previous usage of `locale.getpreferredencoding()`.
On some platforms (e.g. Windows), the encoding used for the console
as given by `sys.*.encoding` can differ from the `locale.getpreferredencoding()` (e.g. `cp437` vs. `cp1252`).

cboos 2006-04-07

changed /trunk/trac/scripts/admin.py
changed /trunk/trac/scripts/tests/admin-tests.txt
changed /trunk/trac/scripts/tests/admin.py
/trunk/trac/scripts/admin.py Diff Switch to side-by-side view
Loading...
/trunk/trac/scripts/tests/admin-tests.txt Diff Switch to side-by-side view
Loading...
/trunk/trac/scripts/tests/admin.py Diff Switch to side-by-side view
Loading...
MongoDB Logo MongoDB