aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRene Meusel <[email protected]>2017-10-11 21:59:17 +0200
committerJack Lloyd <[email protected]>2017-11-09 16:05:17 -0500
commit8a93eae8b6f159c0c66bee0f04bf446ef0bc3ac4 (patch)
treea286545f2e553ad4551236a6f8b3c7bda12363a1
parent3bc43de0a1e8ca1e05dc8b85c0965425b15ad806 (diff)
switch to default utf-8 string in ASN1_String
-rw-r--r--src/lib/asn1/asn1_str.cpp14
-rw-r--r--src/lib/asn1/asn1_str.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/asn1/asn1_str.cpp b/src/lib/asn1/asn1_str.cpp
index 526e10158..aabfd0048 100644
--- a/src/lib/asn1/asn1_str.cpp
+++ b/src/lib/asn1/asn1_str.cpp
@@ -61,11 +61,11 @@ ASN1_Tag choose_encoding(const std::string& str,
/*
* Create an ASN1_String
*/
-ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_iso_8859_str(Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET)), m_tag(t)
+ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_utf8_str(str), m_tag(t)
{
if(m_tag == DIRECTORY_STRING)
- m_tag = choose_encoding(m_iso_8859_str, "latin1");
+ m_tag = choose_encoding(m_utf8_str, "utf8");
if(m_tag != NUMERIC_STRING &&
m_tag != PRINTABLE_STRING &&
@@ -81,7 +81,7 @@ ASN1_String::ASN1_String(const std::string& str, ASN1_Tag t) : m_iso_8859_str(Ch
/*
* Create an ASN1_String
*/
-ASN1_String::ASN1_String(const std::string& str) : m_iso_8859_str(Charset::transcode(str, LOCAL_CHARSET, LATIN1_CHARSET)), m_tag(choose_encoding(m_iso_8859_str, "latin1"))
+ASN1_String::ASN1_String(const std::string& str) : m_utf8_str(str), m_tag(choose_encoding(m_utf8_str, "utf8"))
{}
/*
@@ -89,15 +89,15 @@ ASN1_String::ASN1_String(const std::string& str) : m_iso_8859_str(Charset::trans
*/
std::string ASN1_String::iso_8859() const
{
- return m_iso_8859_str;
+ return Charset::transcode(m_utf8_str, LATIN1_CHARSET, UTF8_CHARSET);
}
/*
-* Return this string in local encoding
+* Return this string in UTF-8 encoding
*/
std::string ASN1_String::value() const
{
- return Charset::transcode(m_iso_8859_str, LATIN1_CHARSET, LOCAL_CHARSET);
+ return m_utf8_str;
}
/*
@@ -136,7 +136,7 @@ void ASN1_String::decode_from(BER_Decoder& source)
charset_is = LATIN1_CHARSET;
*this = ASN1_String(
- Charset::transcode(ASN1::to_string(obj), LOCAL_CHARSET, charset_is),
+ Charset::transcode(ASN1::to_string(obj), UTF8_CHARSET, charset_is),
obj.type_tag);
}
diff --git a/src/lib/asn1/asn1_str.h b/src/lib/asn1/asn1_str.h
index 9e0237550..3ad82582e 100644
--- a/src/lib/asn1/asn1_str.h
+++ b/src/lib/asn1/asn1_str.h
@@ -29,7 +29,7 @@ class BOTAN_PUBLIC_API(2,0) ASN1_String final : public ASN1_Object
explicit ASN1_String(const std::string& = "");
ASN1_String(const std::string&, ASN1_Tag);
private:
- std::string m_iso_8859_str;
+ std::string m_utf8_str;
ASN1_Tag m_tag;
};