Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 翻译错误_Iphone_Objective C - Fatal编程技术网

Iphone 翻译错误

Iphone 翻译错误,iphone,objective-c,Iphone,Objective C,本节目:http://translate.google.com/translate_tts?q=%E4%BD%A0%E5%A5%BD&tl=zh-TW 将url复制到firefox的浏览器。这是正确的中文翻译,但对于safari浏览器来说,这是错误的!为什么中文翻译是错误的。其他语言是正确的!! 请帮帮我 NSString *soundURL = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?q=%@

本节目:
http://translate.google.com/translate_tts?q=%E4%BD%A0%E5%A5%BD&tl=zh-TW

将url复制到firefox的浏览器。这是正确的中文翻译,但对于safari浏览器来说,这是错误的!为什么中文翻译是错误的。其他语言是正确的!! 请帮帮我

NSString *soundURL = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?q=%@&tl=%@",strTextOfFilter,strCodeOfLanguage];
        NSLog(@"URL : %@",soundURL); 

在Safari和您的代码中,只需将
&ie=UTF-8
明确地放在URL的末尾

    NSData *soundData = [NSData dataWithContentsOfURL:[NSURL URLWithString:soundURL]];
    NSLog(@"returnSoundData:%@",[NSURL URLWithString:soundURL]);
    NSError *err = nil;
    AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithData:soundData error: &err];
    [player play];
他做这项工作。我猜谷歌服务器被使用的编码弄糊涂了

http://translate.google.com/translate_tts?q=%E4%BD%A0%E5%A5%BD&tl=zh-TW&ie=UTF-8