8000 How to run python in utf8 · Issue #383 · jython/jython · GitHub
[go: up one dir, main page]

Skip to content
How to run python in utf8 #383
Closed
Closed
@707914178

Description

@707914178

I have specified:
Py.getSystemState().setdefaultencoding("utf-8");

however, garbled text still occurs when I run the following code:

import logging
log = logging.getLogger(name)
print('今天的天气怎么样?{}'.decode('utf-8'))
print('还好吧')
log.info('今天的天气怎么样?{}'.decode('utf-8'), '还好')
result='呵呵'

console:
今天的天气怎么样?{}
还好吧
16:44:21.142 [main] INFO main - 今天的天气怎么样?è¿�好
��

unless I force the use :decode('utf-8')

but print() is correct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0