如果我連接到Heroku的工人DYNO與heroku run
(如heroku run python
一個交互式Python會話),任何試圖顯示Unicode字符通過這導致了UnicodeEncodeError
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'
£
通過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)
>>>
,如果我heroku run bash
和使用echo
嘗試顯示的東西,一切似乎罰款(除了字體的我的地方選擇!):
$ heroku run bash
Running bash attached to terminal... up, run.2
~ $ echo -e "\xa3"
?
我認爲我做錯了/失去了一些東西,但多少有些失落,什麼,或進一步的調查線。
......好吧,這簡直太尷尬了,謝謝! – 2012-03-29 01:00:38
這是現在所有新的Heroku Python應用程序的默認設置:) – 2012-04-01 16:47:29
哦,作爲buildpack的函數? – 2012-04-01 19:44:27