Swift 中的中文与utf-8编码相互转换
2017-07-27 本文已影响537人
流星大石头
中文转 utf-8:
display.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed)
utf-8转中文:
display.removingPercentEncoding (ios10.0之后)
display.replacingPercentEscapes(using: .utf8) (ios10.0之前)