Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Emoji ❤ as a param will get error in windows cmd shell. #172

Open
houbb opened this issue Apr 12, 2019 · 1 comment
Open

BUG: Emoji ❤ as a param will get error in windows cmd shell. #172

houbb opened this issue Apr 12, 2019 · 1 comment

Comments

@houbb
Copy link

houbb commented Apr 12, 2019

【In macOS System】

I test my emoji_cli in macOS, everything goes well.

But in windows, it's not so lucky.

【Bug】
env: python3 & windows system

In test method, english word or chinese and emoji has no question.

In windows cmd or powershell, english word or chinese word eveything goes well.

But when test Emoji such as ❤, it works bad as following :(

> emoji_cli name  redheart
key: redheart

> emoji_cli name "中文"
key: 中文

> emoji_cli name "❤"
key: ?

What should i do to fix this problem?

I have tried encode, deocode, even chardet,but all failed.

Here is my project: https://github.com/houbb/emoji-cli

@houbb houbb changed the title Emoji ❤ as a param will get error in windows cmd shell. BUG: Emoji ❤ as a param will get error in windows cmd shell. Apr 12, 2019
@dbieber
Copy link
Member

dbieber commented Apr 12, 2019

Unfortunately I don't have access to a windows machine to look into this. You can see what Fire is doing at L240. It looks like you're returning a dict, so _DictAsString would be called, which in turn calls _OneLineResult on the emoji. If that's right, the Fire code you'd be interested in is:

  if isinstance(result, six.string_types):
    return str(result).replace('\n', ' ')

  try:
    # Don't force conversion to ascii.
    return json.dumps(result, ensure_ascii=False)
  except (TypeError, ValueError):
    return str(result).replace('\n', ' ')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants