NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How to display german umlauts correctly in unit test output

 
Post new topic   Reply to topic    NetBeans Forums -> PHP Users
View previous topic :: View next topic  
Author Message
FrankPK



Joined: 20 Feb 2017
Posts: 4

PostPosted: Fri Feb 24, 2017 9:26 pm    Post subject: How to display german umlauts correctly in unit test output Reply with quote

Hi,

when I run this code in Netbeans (which echos the german word for door)
Code:
<?php
echo "Tür";

the output window shows
Code:
Tür


Instead, when doing the same output in a unit test like this
Code:
<?php
use PHPUnit\Framework\TestCase;

class EchoTest extends TestCase {
    function testEcho(){
        echo "Tür";
    }
}

I get the output
Code:

Tür


I know that it is no good behaviour to do echo or print_r in unit tests, but sometimes I want to see the contents of a string or variable.

Is it possible to configure the unit test output in such a way that the umlauts are displayed correctly in the netbeans output window?
Back to top
paolosca



Joined: 09 Sep 2010
Posts: 515

PostPosted: Sun Feb 26, 2017 2:54 pm    Post subject: How to display german umlauts correctly in unit test output Reply with quote

Hi,


Have you tried enabling the mbstring extension in php.ini?

Regards,


Paolo
Back to top
FrankPK



Joined: 20 Feb 2017
Posts: 4

PostPosted: Mon Feb 27, 2017 12:42 am    Post subject: How to display german umlauts correctly in unit test output Reply with quote

Hi Paolo,

yes, mbstring is enabled. phpinfo() prints:
Multibyte Support => enabled.

It seems to me that phpunit changes the output from UTF-8 to ISO 8859-1.
Thus my two byte UTF-8 "ü" (11000011 10111100) is displayed as two ISO 8859-1 characters à (11000011) and ¼(10111100).

But now I think this would be more a question in a phpunit forum.

Frank
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> PHP Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo