0

When I set my PATH to point to my XAMPP PHP (5.6, or 7.1) and then run php test.php containing

<?php
echo 'ěščřžýáíé';

encoded in UTF-8, then I get the ěščřžýáíé output displayed correctly in my CLI (Git Bash).

However, when I change my PATH to point to any WAMP PHP (5.6.25, or 7.0.10), as I wanted to part with XAMPP, I get broken output: ─Ť┼í─Ź┼Ö┼ż├Ż├í├ş├ę.

  1. There is the default_charset = "UTF-8" line in all three of WAMP's php.ini files
  2. I have added the line AddDefaultCharset UTF-8 to my WAMP's httpd.conf, though that shouldn't matter at all in CLI mode
  3. I have tried comparing contents of the PHP configuration files (XAMPP/WAMP) side by side but couldn't find any relevant differences
Veve
  • 6,643
  • 5
  • 39
  • 58
Fofry
  • 1
  • You could try issuing `php --ini` to confirm which php.ini is being used in both cases. Also, maybe try `php --php-ini [some-path-to-ini]` to see if using the XAMPP ini with the WAMP php helps. – Harry Pehkonen Dec 12 '17 at 01:18
  • PHP doesn't care about string encoding, the things that display PHP's output care about string encoding. Make sure you're setting the correct HTTP headers so that your browser knows what it's getting. – Sammitch Dec 12 '17 at 18:53
  • @Sammitch >>>CLI == Command Line Interface, so no HTTP header are involved – RiggsFolly Dec 13 '17 at 09:40
  • May be a useful answer to read https://stackoverflow.com/a/36692549/2310830 – RiggsFolly Dec 13 '17 at 09:45

0 Answers0