Fix encoding for go convertor

This commit is contained in:
yicheng 2019-12-07 22:10:55 +08:00
parent d00a34640a
commit af82996226

View File

@ -9,11 +9,11 @@
extension String {
func goStringBuffer() -> UnsafeMutablePointer<Int8> {
if let pointer = (self as NSString)
.cString(using: String.defaultCStringEncoding.rawValue) {
.cString(using: String.Encoding.utf8.rawValue) {
return UnsafeMutablePointer(mutating: pointer)
}
Logger.log("Convert goStringBuffer Fail!!!!", level: .error)
let p = ("" as NSString).cString(using: String.defaultCStringEncoding.rawValue)!
let p = ("" as NSString).cString(using: String.Encoding.utf8.rawValue)!
return UnsafeMutablePointer(mutating: p)
}
}