您的位置:首页 > 移动开发 > IOS开发

iOS开发-zbar解析中文乱码情况

2015-09-21 10:07 483 查看
#pragma mark -- ZBarReaderViewDelegate

-(void)readerView:(ZBarReaderView *)readerView didReadSymbols:(ZBarSymbolSet *)symbols fromImage:(UIImage *)image
{
    const zbar_symbol_t *symbol =zbar_symbol_set_first_symbol(symbols.zbarSymbolSet);
    <span style="color:#ff0000;">NSString *strss =[NSString stringWithUTF8String: zbar_symbol_get_data(symbol)];
    NSString *symbolStr;
    if ([strss canBeConvertedToEncoding:NSShiftJISStringEncoding]) {
         symbolStr = [NSString stringWithCString:[strss cStringUsingEncoding: NSShiftJISStringEncoding] encoding:NSUTF8StringEncoding];
    }</span>
 UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:@""message:[symbolStr stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] delegate:nil cancelButtonTitle:@"取消"otherButtonTitles:nil];
    
    [alertView show];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: