`iconv` 需要安装什么才能使用 PHP8
What needs to be installed for `iconv` to work with PHP8
我正在尝试将 doctrine/rst-parser
迁移到 Github 操作,最后一个障碍是由于调用 iconv
:
而失败的测试
iconv('utf-8', 'us-ascii//TRANSLIT', $text)
测试失败
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>
我已经尝试安装 libc6
ubuntu 包,并安装 iconv
和 intl
PHP 扩展,没有骰子。我应该尝试什么?
这是拉取请求的 link:https://github.com/doctrine/rst-parser/pull/126
编辑:the solution seems to be to do a setlocale(LC_ALL, 'en_US');
,但是 returns false
出于某种原因对 github 操作。
使用 setlocale(LC_ALL, 'en_US.utf8')
解决了这个问题。这是必需的,因为 PHP 8: https://github.com/php/php-src/commit/c4ad8beaa890b931031a5cf8a1d2d38550fca3af
我正在尝试将 doctrine/rst-parser
迁移到 Github 操作,最后一个障碍是由于调用 iconv
:
iconv('utf-8', 'us-ascii//TRANSLIT', $text)
测试失败
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>
我已经尝试安装 libc6
ubuntu 包,并安装 iconv
和 intl
PHP 扩展,没有骰子。我应该尝试什么?
这是拉取请求的 link:https://github.com/doctrine/rst-parser/pull/126
编辑:the solution seems to be to do a setlocale(LC_ALL, 'en_US');
,但是 returns false
出于某种原因对 github 操作。
使用 setlocale(LC_ALL, 'en_US.utf8')
解决了这个问题。这是必需的,因为 PHP 8: https://github.com/php/php-src/commit/c4ad8beaa890b931031a5cf8a1d2d38550fca3af