appconfig.ini don't support multi byte character
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start in gluon/contrib/appconfig.py at read_config_ini and reproduce the issue with Japanese or another multibyte value in appconfig.ini, such as the name or author in the [app] section. Verify the change by opening a controller and confirming the configuration loads without UnicodeDecodeError.
Written by the indexing model from the issue text.
Description
Describe the bug
appconfig.ini don't support multi byte character.
Environment
2.19.1-stable+timestamp.2020.03.21.21.49.28
(Running on nginx/1.14.0, Python 3.6.9)
To Reproduce
Steps to reproduce the behavior:
- Use multi byte character in appconfig.ini. (ex. name or author in [app] section)
- Open any controller
- See error in the ticket
<class 'UnicodeDecodeError'> 'ascii' codec can't decode byte 0xe3 in position 40: ordinal not in range(128)
Expected behavior
The current read_config_ini function in gluon/contrib/appconfig.py is like followings (around line 125).
def read_config_ini(self):
config = configparser.SafeConfigParser()
config.read(self.file)
settings = {}
for section in config.sections():
config.read(self.file) should be as follows.
def read_config_ini(self):
config = configparser.SafeConfigParser()
config.readfp(codecs.open(self.file, "r", "utf8"))
settings = {}
for section in config.sections():
import codecs
is required in the head of gluon/contrib/appconfig.py.
I have confirmed to use Japanese string in appconfig.ini.
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 916
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 8
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from web2py/web2py
-
in PostgreSQL docs Open
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100