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

Unicode character support in command line output #2937

Closed
fanglijun opened this issue Mar 28, 2016 · 10 comments

Comments

@fanglijun
Copy link

commented Mar 28, 2016

$I->wantTo("中文字符");

If characters inside wantTo is unicode, then the first character won't display correctly in command output.
see image
see the second test in the image? the first character should be "添", but it shows "3?"

@Naktibalda

This comment has been minimized.

Copy link
Member

commented Mar 28, 2016

I failed to reproduce your issue - I tested a number of different versions including 2.0.10, 2.1.7 and 2.2.0-beta and all of them produced correct output.

What version of Codeception are you using? Are you using phar file or installed it with composer?
Is mbstring extension installed?

@fanglijun

This comment has been minimized.

Copy link
Author

commented Mar 29, 2016

I use version 2.1.7,mbstring is installed. I use mac and https://github.com/robbyrussell/oh-my-zsh
"中文字符" -> output as "ĸ?文字符"

@fanglijun

This comment has been minimized.

Copy link
Author

commented Mar 29, 2016

It maybe caused by the auto-to-uppercase of the first character? @Naktibalda

@Naktibalda

This comment has been minimized.

Copy link
Member

commented Mar 29, 2016

I don't think so,

Relevant code:

$this->scenario->setFeature(mb_strtolower($text, 'utf-8'));

return $this->getFeature() . " (" . $this->getSignature() . ")";

  1. It could be a terminal issue, have you checked if it can display character 中?
  2. Text in your code example differs from text in the screenshot.
@Naktibalda

This comment has been minimized.

Copy link
Member

commented Mar 29, 2016

@ohfang Could you do some debugging and try to locate where the first character is broken?

@fanglijun

This comment has been minimized.

Copy link
Author

commented Mar 30, 2016

OK, I will try.

@fanglijun

This comment has been minimized.

@Naktibalda

This comment has been minimized.

Copy link
Member

commented Mar 30, 2016

Could you replace that line with

->message($inProgress ? $feature : (mb_strtoupper(mb_substr($feature, 0, 1, 'utf-8'), 'utf-8') . mb_substr($feature, 1, null, 'utf-8'))
@fanglijun

This comment has been minimized.

Copy link
Author

commented Mar 31, 2016

It's working.
#2946

@Naktibalda

This comment has been minimized.

Copy link
Member

commented Apr 2, 2016

Thank you

@Naktibalda Naktibalda closed this Apr 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.