Description
In 1.3.0, we can freely use uncode strings for configurations in either wikiconfig.py or farmconfig.py, for example:
1 sitename = "胡水日记"
2 page_front_page = '首页'
3 navi_bar = [
4 # Will use page_front_page, (default FrontPage)
5 '%(page_front_page)s',
6 '日记',
7 '留言',
8 'RecentChanges',
9 'FindPage',
10 'HelpContents',
11 ]
12 page_category_regex = '^Category[A-Z]|类$' # [Unicode]
13 page_dict_regex = '[a-z]Dict$|字典$' # [Unicode]
14 page_form_regex = '[a-z]Form$|表$' # [Unicode]
15 page_group_regex = '[a-z]Group$|组$' # [Unicode]
16 page_template_regex = '[a-z]Template$|模板$' # [Unicode]
But in 1.3.1 these unicode strings has to prefixed with u explicitly:
1 sitename = u"胡水日记"
2 page_front_page = u'首页'
3 navi_bar = [
4 # Will use page_front_page, (default FrontPage)
5 '%(page_front_page)s',
6 u'日记',
7 u'留言',
8 'RecentChanges',
9 'FindPage',
10 'HelpContents',
11 ]
12 page_category_regex = u'^Category[A-Z]|类$' # [Unicode]
13 page_dict_regex = u'[a-z]Dict$|字典$' # [Unicode]
14 page_form_regex = u'[a-z]Form$|表$' # [Unicode]
15 page_group_regex = u'[a-z]Group$|组$' # [Unicode]
16 page_template_regex = u'[a-z]Template$|模板$' # [Unicode]
Don't know if it's a bug or not. If it is not a bug, it should clearly stated in the configuration instructions, otherwise people will get confused.
Isn't it on HelpOnConfiguration and in CHANGES?
Sorry ==> Did not read HelpOnConfiguration or CHANGES before reporting. False alarm. -- JunHu 2004-12-13 11:00:48
Example
if not prefixed with u, a mess:
if prefixed with u, nice:
Details
MoinMoin Version |
1.3.1 |
OS and Version |
Fedora core 3 |
Python Version |
2.3.4 |
Server Setup |
Apache |
Server Details |
|
Workaround
Prefix the unicode strings with u explicitly. - Exactly! And add a coding line if you don't already have.
Discussion
Read CHANGES and new sample configs.
In 1.3.2 you might be able to use unicode strings freely as before, if you are using utf-8 encoding. Only non utf-8 will have to use the u'string' format for non ascii values, as we can decode automatically only from utf-8.
I am not sure yet if this is a good thing. Maybe we should rather have one definite method than a "if you use utf-8 do it like that, if not, do it other" -- ThomasWaldmann 2004-12-13 18:46:25
In case of an error, you will get a nice helpful error message when you have encoding problem in the config file. The wiki will not run with wrong configuration as 1.3.1 does.
A patch implementing this will be committed soon. -- NirSoffer 2004-12-13 16:39:06
First discuss on channel.
Plan
- Priority: None
Assigned to: ThomasWaldmann
- Status: no bug