Unicode character support in command line output #2937

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

Comments

Projects
None yet
2 participants
@fanglijun

$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.

Show comment
Hide comment
@Naktibalda

Naktibalda Mar 28, 2016

Member

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?

Member

Naktibalda 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.

Show comment
Hide comment
@fanglijun

fanglijun 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 "ĸ?文字符"

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.

Show comment
Hide comment
@fanglijun

fanglijun Mar 29, 2016

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

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

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Mar 29, 2016

Member

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.
Member

Naktibalda 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.

Show comment
Hide comment
@Naktibalda

Naktibalda Mar 29, 2016

Member

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

Member

Naktibalda 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.

Show comment
Hide comment
@fanglijun

fanglijun Mar 30, 2016

OK, I will try.

OK, I will try.

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Mar 30, 2016

Member

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'))
Member

Naktibalda 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.

Show comment
Hide comment
@fanglijun

fanglijun Mar 31, 2016

It's working.
#2946

It's working.
#2946

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Apr 2, 2016

Member

Thank you

Member

Naktibalda 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