Skip to content

fix: 解决emoji在content.length中占2长度,substring时却只算1长度的问题 #651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hiro0729
Copy link

已解决 #650 中提到的问题,本地运行截图效果如下

微信截图_20250611211702

@hiro0729 hiro0729 changed the title 解决emoji在content.length中占2长度,substring时却只算1长度的问题 fix: 解决emoji在content.length中占2长度,substring时却只算1长度的问题 Jun 11, 2025
@jin-yufeng
Copy link
Owner

image
emojisubstring 里也是 2 个长度吧
另外我在示例项目里测试这个内容也是正常的
image

@hiro0729
Copy link
Author

@jin-yufeng 我的substring和你的效果不一样,是环境问题,你的是mac电脑么?看来是不同js环境中的substring表现不一致
wechat_2025-06-15_220946_036

@hiro0729
Copy link
Author

IOS 18真机也一样可以复现
微信图片_2025-06-15_221803_348

@hiro0729
Copy link
Author

🤦🏻‍♂️这种扩展的emoji的length是7更夸张,substring各种长度能分割出各种结果,我现在小程序本地修改后也能正常显示

wechat_2025-06-16_103314_720
wechat_2025-06-16_103436_864

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants