Skip to content
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

去除零宽字符崩溃 #1542

Open
happy201993 opened this issue Feb 7, 2024 · 1 comment
Open

去除零宽字符崩溃 #1542

happy201993 opened this issue Feb 7, 2024 · 1 comment
Labels

Comments

@happy201993
Copy link

Bug 表现
崩溃

截图
Bug 现场的界面截图,或者 Xcode 控制台的错误信息截图,有问题的代码截图
image

如何重现
运行下面的代码,崩溃
NSString *text = @"18‍22";
[text qmui_stringByReplacingPattern:@"[\u200b-\u200f\uFEFF\u202a-\u202e]" withString:@""];

预期的表现
不崩溃,并且能替换掉零宽字符

其他信息

  • 设备: 模拟器
  • iOS 版本: 所有版本
  • Xcode 版本: Xcode 15
  • QMUI 版本: [4.7.0]
@MoLice
Copy link
Collaborator

MoLice commented Feb 14, 2024

QMUIStringPrivate 里对 -[NSStirng substringWithRange:] 处理 ComposedCharacterSequence 的保护,在正则表达式替换时反而是不需要的,这会导致你例子里的 replace 不符合预期,无法将“18‍22”(请直接复制)替换为“1822”,目前请先用以下文件替换你本地的同名文件,后续会修复。
QMUIStringPrivate.m.zip

@MoLice MoLice added the bug label Feb 14, 2024
@Tencent Tencent deleted a comment from happy201993 Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants