Swift从MPMoviePlayerController元数据读入UTF8字符串

时间:2016-06-14 12:34:16

标签: swift utf-8 metadata diacritics

我需要阅读一些可以包含法语或德语字符的元数据。修饰

我认为我需要将元数据作为UTF8 String读取。但作为Swift和Apple的初学者,我不知道该怎么做。

我尝试在stackOverflow上找到一些类似的解决方案,但都没有。

我正在与之合作:

<DataGrid.Resources>
    <local:BindingProxy x:Key="proxy" Data="{Binding}" />
</DataGrid.Resources>

我得到了

  

AntoninDvoÅák

而不是

  

AntoninDvořák

任何想法?

如何使用AVPlayer从在线音频流中获取UTF8元数据的简单解决方案 https://stackoverflow.com/a/37831097/4249825

2 个答案:

答案 0 :(得分:2)

这是库中的问题,您无法修复它,因为该字符串已经从数据中解码。

为什么在iOS 9中不推荐使用整个类。

你应该使用AVPlayerViewController&amp; AVPlayer&amp; AVPlayerItem&amp; AVMetadataItem

他们正在解决这个问题。请勿使用MPMoviePlayerController

答案 1 :(得分:-1)

let convertedString = String(data: metaData.dataUsingEncoding(NSISOLatin1StringEncoding)!, encoding: NSUTF8StringEncoding)!