gpt4 book ai didi

unicode - 如何将 length() 用于 unicode 字符?

转载 作者:行者123 更新时间:2023-12-01 11:45:31 25 4
gpt4 key购买 nike

在 Moovweb SDK 中工作时,length("çãêá") 应返回 4,但返回 8。如何确保 length 函数在使用 Unicode 字符时是否正常工作?

最佳答案

这是 Unicode 字符和使用错误字符集的 length() 函数的常见问题。要修复它,您需要设置 charset_determined 变量以确保在调用 length() 之前使用了正确的字符集,就像在您的 tritium 代码中一样:

$charset_determined = "utf-8"
# your call to length() here

关于unicode - 如何将 length() 用于 unicode 字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15710089/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com