Use UTF-8 instead of ASCII for encoding (#44)

This commit is contained in:
Bob Sun 2017-03-01 14:54:52 +08:00
parent 6d7bf62cf7
commit bde475a49f
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
2 changed files with 2 additions and 2 deletions

View file

@ -104,7 +104,7 @@ class Password {
}
func getPlainData() -> Data {
return getPlainText().data(using: .ascii)!
return getPlainText().data(using: .utf8)!
}
private func getAdditionValue(withKey key: String) -> String? {

View file

@ -15,7 +15,7 @@ extension PasswordEntity {
let encryptedDataPath = URL(fileURLWithPath: "\(Globals.repositoryPath)/\(rawPath!)")
let encryptedData = try Data(contentsOf: encryptedDataPath)
let decryptedData = try PasswordStore.shared.pgp.decryptData(encryptedData, passphrase: passphrase)
let plainText = String(data: decryptedData, encoding: .ascii) ?? ""
let plainText = String(data: decryptedData, encoding: .utf8) ?? ""
password = Password(name: name!, plainText: plainText)
return password
}