Skip to content

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

Open
hiro0729 wants to merge 1 commit into
jin-yufeng:masterfrom
hiro0729:master
Open

fix: 解决emoji在content.length中占2长度,substring时却只算1长度的问题#651
hiro0729 wants to merge 1 commit into
jin-yufeng:masterfrom
hiro0729:master

Conversation

@hiro0729

Copy link
Copy Markdown

已解决 #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
Copy Markdown
Owner

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

@hiro0729

Copy link
Copy Markdown
Author

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

@hiro0729

Copy link
Copy Markdown
Author

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

@hiro0729

Copy link
Copy Markdown
Author

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

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

@jin-yufeng
jin-yufeng force-pushed the master branch 2 times, most recently from 84c5db6 to f7f8b8d Compare December 14, 2025 05:59
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