// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
-// facename[;charset]
+// encodingid;facename[;charset]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T(";"));
+ wxString encid = tokenizer.GetNextToken();
+ long enc;
+ if ( !encid.ToLong(&enc) )
+ return FALSE;
+ encoding = (wxFontEncoding)enc;
+
facename = tokenizer.GetNextToken();
if ( !facename )
return FALSE;
wxString wxNativeEncodingInfo::ToString() const
{
- wxString s(facename);
+ wxString s;
+
+ s << (long)encoding << _T(';') << facename;
+
if ( charset != 0 )
{
s << _T(';') << charset;
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
-// facename[;charset]
+// encodingid;facename[;charset]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T(";"));
+ wxString encid = tokenizer.GetNextToken();
+ long enc;
+ if ( !encid.ToLong(&enc) )
+ return FALSE;
+ encoding = (wxFontEncoding)enc;
+
facename = tokenizer.GetNextToken();
if ( !facename )
return FALSE;
wxString wxNativeEncodingInfo::ToString() const
{
- wxString s(facename);
+ wxString s;
+
+ s << (long)encoding << _T(';') << facename;
+
if ( charset != 0 )
{
s << _T(';') << charset;
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
-// facename[;charset]
+// encodingid;facename[;charset]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T(";"));
+ wxString encid = tokenizer.GetNextToken();
+ long enc;
+ if ( !encid.ToLong(&enc) )
+ return FALSE;
+ encoding = (wxFontEncoding)enc;
+
facename = tokenizer.GetNextToken();
if ( !facename )
return FALSE;
wxString wxNativeEncodingInfo::ToString() const
{
- wxString s(facename);
+ wxString s;
+
+ s << (long)encoding << _T(';') << facename;
if ( charset != ANSI_CHARSET )
{
- s << _T(';') << charset;
+ s << _T(';') << charset;
}
return s;
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
-// facename[;charset]
+// encodingid;facename[;charset]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
wxStringTokenizer tokenizer(s, _T(";"));
+ wxString encid = tokenizer.GetNextToken();
+ long enc;
+ if ( !encid.ToLong(&enc) )
+ return FALSE;
+ encoding = (wxFontEncoding)enc;
+
facename = tokenizer.GetNextToken();
if ( !facename )
return FALSE;
wxString wxNativeEncodingInfo::ToString() const
{
- wxString s(facename);
+ wxString s;
+
+ s << (long)encoding << _T(';') << facename;
+
// TODO: what is this for OS/2?
/*
if ( charset != ANSI_CHARSET )
// ----------------------------------------------------------------------------
// convert to/from the string representation: format is
-// registry-encoding[-facename]
+// encodingid;registry;encoding[;facename]
bool wxNativeEncodingInfo::FromString(const wxString& s)
{
- wxStringTokenizer tokenizer(s, _T("-"));
+ wxStringTokenizer tokenizer(s, _T(";"));
+ // cannot use "-" because it may be part of encoding name
+
+ wxString encid = tokenizer.GetNextToken();
+ long enc;
+ if ( !encid.ToLong(&enc) )
+ return FALSE;
+ encoding = (wxFontEncoding)enc;
xregistry = tokenizer.GetNextToken();
if ( !xregistry )
wxString wxNativeEncodingInfo::ToString() const
{
wxString s;
- s << xregistry << _T('-') << xencoding;
+ s << (long)encoding << _T(';') << xregistry << _T(';') << xencoding;
if ( !!facename )
{
- s << _T('-') << facename;
+ s << _T(';') << facename;
}
return s;