Kri*_*ass 2 python unicode heroku
如果我连接到Heroku worker dyno heroku run(例如,heroku run python用于交互式Python会话),任何通过此方式显示Unicode字符的尝试都会导致UnicodeEncodeError
本地:
$ python
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> print u'\xa3'
£
Run Code Online (Sandbox Code Playgroud)
通过heroku run:
$ heroku run python
Running python attached to terminal... up, run.1
Python 2.7.2 (default, Oct 31 2011, 16:22:04)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print u'\xa3'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 0: ordinal not in range(128)
>>>
Run Code Online (Sandbox Code Playgroud)
现在,如果我heroku run bash和使用echo尝试显示的东西,一切似乎都很好(除了我本地选择的字体!):
$ heroku run bash
Running bash attached to terminal... up, run.2
~ $ echo -e "\xa3"
?
Run Code Online (Sandbox Code Playgroud)
我认为我做错了什么/错过了什么,但有些失去了什么,或进一步调查.
| 归档时间: |
|
| 查看次数: |
1284 次 |
| 最近记录: |