I'm trying to migrate doctrine/rst-parser
to Github actions, and the last hurdle is a test that fails because of a call to iconv
:
iconv('utf-8', 'us-ascii//TRANSLIT', $text)
The test fails with
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
<li class="dash">Test list item 1.</li>
<li class="dash">Test list item 2.</li>
</ul>
-<p class="rot-gelb-blau grun-2008">Weird class names.</p>
+<p class="rot-gelb-blau grn-2008">Weird class names.</p>
I have tried installing the libc6
ubuntu package, and installing the iconv
and intl
PHP extensions, no dice. What should I try?
Here is a link to the pull request: https://github.com/doctrine/rst-parser/pull/126
EDIT: the solution seems to be to do a setlocale(LC_ALL, 'en_US');
, but that returns false
on github actions for some reason.
My Answer:
To make `iconv` work with PHP8, you need to ensure that the `iconv` extension is installed and enabled in your PHP configuration. You can typically install the `iconv` extension using your package manager or by compiling PHP with the `--enable-iconv` flag.
If you are using a Linux distribution, you can install the `iconv` extension using the following commands:
For Ubuntu/Debian:
sudo apt-get install php8.0-iconv
For CentOS/RHEL:
sudo yum install php80-php-iconv
After installing the `iconv` extension, you may need to restart your web server for the changes to take effect.
Once the `iconv` extension is installed and enabled, the `iconv` function should work as expected in your PHP code.
Rate this post
5 of 5 based on 9648 votesComments