UIPasteboard 副本无法在 Notes 和 Mail 中正确粘贴
我使用以下代码将包含英语和希伯来语字符的文本字符串复制到 UIPasteboard 中。
UIPasteboard *appPasteBoard = [UIPasteboard generalPasteboard];
appPasteBoard.persistent = YES;
NSString *toCopy = [self.workingDvarTorah description];
[appPasteBoard setValue:toCopy forPasteboardType:(NSString *)kUTTypeUTF8PlainText];
我已经实现了我自己版本的描述方法,要复制相关数据,如下所示:
- (NSString *)description{
// Build a string from the tags
NSMutableString *tags = [[[NSMutableString alloc] init] autorelease];
BOOL isFirstTag = YES;
for (Tag *aTag in self.tags) {
// Add a comma where necessary, but make
// sure that we're not adding a comma to
// the beginning of the first tag.
if (isFirstTag) {
isFirstTag = NO;
[tags appendFormat:@" "];
}else{
[tags appendFormat:@", "];
}
[tags appendFormat:@"%@", aTag.tagText];
}
return [NSString stringWithFormat:@"%@ \n\n %@\n\n%@: %@", self.dvarTorahTitle, self.dvarTorahContent, NSLocalizedString(@"Tags", @""), tags];
}
文本复制到粘贴板,但是当我将其粘贴到笔记或邮件中时,会出现某些字符,即 dagesh,unicode 字符 05BC作为一个盒子,而不是它应该的方式。我已经尝试了所有文本尿路感染类型。
我做错了什么吗?这是 iOS 或 Notes 应用程序中的错误吗?
除了删除有问题的字符之外,我还能做什么来纠正问题?
I'm using the following code to copy a string of text which contains both English and Hebrew characters into UIPasteboard.
UIPasteboard *appPasteBoard = [UIPasteboard generalPasteboard];
appPasteBoard.persistent = YES;
NSString *toCopy = [self.workingDvarTorah description];
[appPasteBoard setValue:toCopy forPasteboardType:(NSString *)kUTTypeUTF8PlainText];
I've implemented my own version of the description method, to copy the relevant data, here's that:
- (NSString *)description{
// Build a string from the tags
NSMutableString *tags = [[[NSMutableString alloc] init] autorelease];
BOOL isFirstTag = YES;
for (Tag *aTag in self.tags) {
// Add a comma where necessary, but make
// sure that we're not adding a comma to
// the beginning of the first tag.
if (isFirstTag) {
isFirstTag = NO;
[tags appendFormat:@" "];
}else{
[tags appendFormat:@", "];
}
[tags appendFormat:@"%@", aTag.tagText];
}
return [NSString stringWithFormat:@"%@ \n\n %@\n\n%@: %@", self.dvarTorahTitle, self.dvarTorahContent, NSLocalizedString(@"Tags", @""), tags];
}
The text copies to the pasteboard, but when I paste it into notes or mail, certain characters, nameley the dagesh, unicode character 05BC, appears as a box, instead of the way it should. I've tried all of the text UTI types.
Am I doing something wrong? Is this a bug in iOS or the Notes app?
What can I do, short of stripping the offending characters, to correct the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据维基百科,带有 dagesh 的希伯来语字符有两种表示形式。显然,存在一个“组合字符”和由两个替代字符组成的替代表示。创建我的初始数据文件的程序可能使用了组合字符。当在没有组合字符的情况下再次导出数据时,复制粘贴起作用了。
因此,iOS 版 Notes 和 Mail 似乎不支持某些字符。
According to Wikipedia, there are two representations of Hebrew characters with dagesh in them. Apparently, there is a "combined character" and an alternate representation composed of two alternate characters. The program which created my initial data file may have used the combined character. When the data was exported again without the combined characters, the copy-paste worked.
So, it looks like there are certain characters that are unsupported by Notes and Mail for iOS.