【发布时间】:2012-01-02 18:11:58
【问题描述】:
我正在使用以下代码将包含英语和希伯来语字符的文本字符串复制到 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];
}
文本复制到粘贴板,但是当我将其粘贴到便笺或邮件中时,某些字符(nameley the dagesh,unicode 字符 05BC)显示为一个框,而不是应有的方式。我已经尝试了所有文本 UTI 类型。
我做错了吗?这是 iOS 或 Notes 应用程序中的错误吗?
除了删除有问题的字符之外,我还能做些什么来纠正问题?
【问题讨论】:
标签: iphone objective-c ios character-encoding uipasteboard