Created
February 11, 2017 14:26
-
-
Save bananafish911/e8c93cb1670d83f7ca7f9a67e29943f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AVMetadataItem with utf8 string (eg. Ukrainian, Russian) | |
// | |
import Foundation | |
import AVFoundation | |
extension AVMetadataItem { | |
/// stringValue: ISO-8859-1 → UTF-8 | |
var utf8String: String? { | |
guard let data = stringValue?.data(using: String.Encoding.isoLatin1, allowLossyConversion: true) else { | |
return nil | |
} | |
return String(data: data as Data, encoding: String.Encoding.utf8) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment