38#include <fmt/chrono.h>
60 wxString filtered_fullpath = aFullFilename;
65 filtered_fullpath.Replace(
"/",
"_" );
66 filtered_fullpath.Replace(
"\\",
"_" );
69 if( filtered_fullpath.Length() > 1 && filtered_fullpath[1] ==
':' )
70 filtered_fullpath[1] =
' ';
73 if( wxString::npos != filtered_fullpath.find_first_of( wxFileName::GetForbiddenChars() ) )
83 bool inOverbar =
false;
86 if( aOldStr == wxT(
"~" ) )
89 newStr.reserve( aOldStr.length() );
91 for( wxString::const_iterator chIt = aOldStr.begin(); chIt != aOldStr.end(); ++chIt )
95 wxString::const_iterator lookahead = chIt + 1;
97 if( lookahead != aOldStr.end() && *lookahead ==
'~' )
99 if( ++lookahead != aOldStr.end() && *lookahead ==
'{' )
103 newStr << wxT(
"~~{}" );
108 newStr << wxT(
"~" );
112 else if( lookahead != aOldStr.end() && *lookahead ==
'{' )
122 newStr << wxT(
"}" );
127 newStr << wxT(
"~{" );
134 else if( ( *chIt ==
' ' || *chIt ==
'}' || *chIt ==
')' ) && inOverbar )
137 newStr << wxT(
"}" );
146 newStr << wxT(
"}" );
156 for( wxString::iterator ii = aString->begin(); ii != aString->end(); ++ii )
158 if( *ii == L
'\u00B4' || *ii == L
'\u2018' || *ii == L
'\u2019' )
163 if( *ii == L
'\u201C' || *ii == L
'\u201D' )
168 if( *ii == L
'\u2013' || *ii == L
'\u2014' )
182 std::vector<bool> braceStack;
184 converted.reserve( aSource.length() );
186 for( wxUniChar c: aSource )
191 converted += wxT(
"{slash}" );
192 else if( c ==
'\n' || c ==
'\r' )
193 converted += wxEmptyString;
201 converted += wxT(
"{slash}" );
203 converted += wxT(
"{backslash}" );
205 converted += wxT(
"{lt}" );
207 converted += wxT(
"{gt}" );
209 converted += wxT(
"{colon}" );
211 converted += wxT(
"{dblquote}" );
212 else if( c ==
'\n' || c ==
'\r' )
213 converted += wxEmptyString;
220 converted += wxT(
"{slash}" );
222 converted += wxT(
"{comma}" );
224 converted += wxT(
"{dblquote}" );
231 converted += wxT(
"{dblquote}" );
237 if( c >= 0x7F || c ==
'\'' || c ==
'\\' || c ==
'(' || c ==
')' )
239 unsigned int code = c;
241 snprintf( buffer,
sizeof(buffer),
"\\u%4.4X", code );
251 if( c ==
'\n' || c ==
'\r' )
252 converted += wxT(
"{return}" );
259 converted += wxT(
"{slash}" );
261 converted += wxT(
"{backslash}" );
263 converted += wxT(
"{dblquote}" );
265 converted += wxT(
"{lt}" );
267 converted += wxT(
"{gt}" );
269 converted += wxT(
"{bar}" );
271 converted += wxT(
"{colon}" );
273 converted += wxT(
"{tab}" );
274 else if( c ==
'\n' || c ==
'\r' )
275 converted += wxT(
"{return}" );
282 converted += wxT(
"{space}" );
289 converted += wxT(
"{comma}" );
290 else if( c ==
'\n' || c ==
'\r' )
291 converted += wxT(
"{return}" );
307 size_t sourceLen = aSource.length();
316 newbuf.reserve( sourceLen );
321 for(
size_t i = 0; i < sourceLen; ++i )
330 bool terminated =
false;
332 for( i = i + 1; i < sourceLen; ++i )
356 else if( prev ==
'$' || prev ==
'~' || prev ==
'^' || prev ==
'_' )
360 else if( token == wxT(
"dblquote" ) ) newbuf << wxT(
"\"" );
361 else if( token == wxT(
"quote" ) ) newbuf << wxT(
"'" );
362 else if( token == wxT(
"lt" ) ) newbuf << wxT(
"<" );
363 else if( token == wxT(
"gt" ) ) newbuf << wxT(
">" );
364 else if( token == wxT(
"backslash" ) ) newbuf << wxT(
"\\" );
365 else if( token == wxT(
"slash" ) ) newbuf << wxT(
"/" );
366 else if( token == wxT(
"bar" ) ) newbuf << wxT(
"|" );
367 else if( token == wxT(
"comma" ) ) newbuf << wxT(
"," );
368 else if( token == wxT(
"colon" ) ) newbuf << wxT(
":" );
369 else if( token == wxT(
"space" ) ) newbuf << wxT(
" " );
370 else if( token == wxT(
"dollar" ) ) newbuf << wxT(
"$" );
371 else if( token == wxT(
"tab" ) ) newbuf << wxT(
"\t" );
372 else if( token == wxT(
"return" ) ) newbuf << wxT(
"\n" );
373 else if( token == wxT(
"brace" ) ) newbuf << wxT(
"{" );
396 result.reserve( aString.length() );
398 for(
const wxString& word : words )
400 if( !result.IsEmpty() )
401 result += wxT(
" " );
403 result += word.Capitalize();
414 const char* start = aSource;
417 while( (cc = *aSource++) != 0 )
437 if( cc !=
'"' && cc !=
'\\' )
451 return aSource - start;
461 const char* start = aSource;
462 char* limit = aDest + aDestSize - 1;
465 while( ( cc = *aSource++ ) != 0 && aDest < limit )
484 if( cc !=
'"' && cc !=
'\\' )
499 return aSource - start;
505 wxString str = aString;
508 str.Replace( wxT(
"\r\n" ), wxT(
"\r" ) );
509 str.Replace( wxT(
"\n" ), wxT(
"\r" ) );
511 std::string utf8 =
TO_UTF8( aString );
515 ret.reserve( utf8.length() + 2 );
519 for( std::string::const_iterator it = utf8.begin(); it!=utf8.end(); ++it )
527 else if( *it ==
'\\' )
548 converted.reserve( aString.length() );
550 for( wxUniChar c : aString )
553 converted += wxT(
""" );
555 converted += wxT(
"'" );
557 converted += wxT(
"&" );
559 converted += wxT(
"<" );
561 converted += wxT(
">" );
572 wxString converted = aString;
575 static const std::map<wxString, wxString> c_replacements = {
576 { wxS(
"quot" ), wxS(
"\"" ) },
577 { wxS(
"apos" ), wxS(
"'" ) },
578 { wxS(
"amp" ), wxS(
"&" ) },
579 { wxS(
"lt" ), wxS(
"<" ) },
580 { wxS(
"gt" ), wxS(
">" ) }
585 wxString regexStr =
"&(#(\\d*)|#x([a-zA-Z0-9]{4})";
587 for(
auto& [key, value] : c_replacements )
588 regexStr <<
'|' << key;
592 wxRegEx regex( regexStr );
599 wxString str = converted;
601 while( regex.Matches( str ) )
603 std::vector<wxString> matches;
604 regex.GetMatch( &start, &len );
606 result << str.Left( start );
608 wxString code = regex.GetMatch( str, 1 );
609 wxString codeDec = regex.GetMatch( str, 2 );
610 wxString codeHex = regex.GetMatch( str, 3 );
612 if( !codeDec.IsEmpty() || !codeHex.IsEmpty() )
614 unsigned long codeVal = 0;
616 if( !codeDec.IsEmpty() )
617 codeDec.ToCULong( &codeVal );
618 else if( !codeHex.IsEmpty() )
619 codeHex.ToCULong( &codeVal, 16 );
622 result << wxUniChar( codeVal );
624 else if(
auto val =
get_opt( c_replacements, code ) )
629 str = str.Mid( start + len );
640 wxString str = aInput;
641 wxRegEx( wxS(
"<[^>]*>" ) ).ReplaceAll( &str, wxEmptyString );
649 static wxRegEx regex( wxS(
"\\b(https?|ftp|file)://([-\\w+&@#/%?=~|!:,.;]*[^.,:;<>\\s\u00b6])" ),
652 regex.ReplaceAll( &aStr,
"<a href=\"\\0\">\\0</a>" );
660 static wxRegEx regex( wxS(
"(https?|ftp|file)://([-\\w+&@#/%?=~|!:,.;]*[^.,:;<>\\s\u00b6])" ),
663 regex.ReplaceAll( &aStr,
"<a href=\"\\0\">\\0</a>" );
665 return regex.Matches( aStr );
671 wxString tmp = aString;
673 return tmp.Trim(
true ).Trim(
false ).IsEmpty();
680 int overbarDepth = -1;
681 int superSubDepth = -1;
682 int braceNesting = 0;
684 for(
auto chIt = aString.begin(),
end = aString.end(); chIt <
end; ++chIt )
692 else if( *chIt ==
'^' && superSubDepth == -1 )
694 auto lookahead = chIt;
696 if( ++lookahead !=
end && *lookahead ==
'{' )
699 superSubDepth = braceNesting;
704 else if( *chIt ==
'_' && superSubDepth == -1 )
706 auto lookahead = chIt;
708 if( ++lookahead !=
end && *lookahead ==
'{' )
711 superSubDepth = braceNesting;
716 else if( *chIt ==
'~' && overbarDepth == -1 )
718 auto lookahead = chIt;
720 if( ++lookahead !=
end && *lookahead ==
'{' )
723 overbarDepth = braceNesting;
728 else if( *chIt ==
'{' )
732 else if( *chIt ==
'}' )
734 if( braceNesting > 0 )
737 if( braceNesting == superSubDepth )
743 if( braceNesting == overbarDepth )
759 static const char whitespace[] =
" \t\n\r\f\v";
763 while( *
text && strchr( whitespace, *
text ) )
766 char* cp =
text + strlen(
text ) - 1;
768 while( cp >=
text && strchr( whitespace, *cp ) )
776char*
GetLine( FILE* File,
char* Line,
int* LineNum,
int SizeLine )
779 if( fgets( Line, SizeLine, File ) ==
nullptr )
785 }
while( Line[0] ==
'#' || Line[0] ==
'\n' || Line[0] ==
'\r' || Line[0] == 0 );
787 strtok( Line,
"\n\r" );
798#if defined(__MINGW32__) && !defined(_UCRT)
799 return fmt::format(
"{:%FT%T}", fmt::localtime( std::time(
nullptr ) ) );
801 return fmt::format(
"{:%FT%T%z}", fmt::localtime( std::time(
nullptr ) ) );
806int StrNumCmp(
const wxString& aString1,
const wxString& aString2,
bool aIgnoreCase )
808 int nb1 = 0, nb2 = 0;
810 auto str1 = aString1.begin();
811 auto str2 = aString2.begin();
813 while( str1 != aString1.end() && str2 != aString2.end() )
815 wxUniChar c1 = *str1;
816 wxUniChar c2 = *str2;
818 if( wxIsdigit( c1 ) && wxIsdigit( c2 ) )
826 nb1 = nb1 * 10 + (int) c1 -
'0';
828 }
while( str1 != aString1.end() && wxIsdigit( *str1 ) );
833 nb2 = nb2 * 10 + (int) c2 -
'0';
835 }
while( str2 != aString2.end() && wxIsdigit( *str2 ) );
843 c1 = ( str1 != aString1.end() ) ? *str1 : wxUniChar( 0 );
844 c2 = ( str2 != aString2.end() ) ? *str2 : wxUniChar( 0 );
852 wxUniChar uc1 = wxToupper( c1 );
853 wxUniChar uc2 = wxToupper( c2 );
856 return uc1 < uc2 ? -1 : 1;
868 if( str1 != aString1.end() )
871 if( str2 != aString2.end() )
875 if( str1 == aString1.end() && str2 != aString2.end() )
879 else if( str1 != aString1.end() && str2 == aString2.end() )
889 bool case_sensitive )
891 const wxChar* cp =
nullptr;
892 const wxChar* mp =
nullptr;
893 const wxChar* wild =
nullptr;
894 const wxChar* str =
nullptr;
895 wxString _pattern, _string_to_tst;
899 wild = pattern.GetData();
900 str = string_to_tst.GetData();
905 _pattern.MakeUpper();
906 _string_to_tst = string_to_tst;
907 _string_to_tst.MakeUpper();
908 wild = _pattern.GetData();
909 str = _string_to_tst.GetData();
912 while( ( *str ) && ( *wild !=
'*' ) )
914 if( ( *wild != *str ) && ( *wild !=
'?' ) )
931 else if( ( *wild == *str ) || ( *wild ==
'?' ) )
943 while( *wild ==
'*' )
955 static const wxString modifiers( wxT(
"pnuµμmkKM" ) );
957 if( !aString.length() )
963 if( modifiers.Find( aString[ 0 ] ) >= 0 )
965 modifier = aString[ 0 ];
966 units = aString.Mid( 1 ).Trim();
971 units = aString.Mid( 0 ).Trim();
975 && !units.IsSameAs( wxT(
"F" ),
false )
976 && !units.IsSameAs( wxT(
"hz" ),
false )
977 && !units.IsSameAs( wxT(
"W" ),
false )
978 && !units.IsSameAs( wxT(
"V" ),
false )
979 && !units.IsSameAs( wxT(
"A" ),
false )
980 && !units.IsSameAs( wxT(
"H" ),
false ) )
985 if( modifier ==
'p' )
987 if( modifier ==
'n' )
989 else if( modifier ==
'u' || modifier == wxS(
"µ" )[0] || modifier == wxS(
"μ" )[0] )
991 else if( modifier ==
'm' )
993 else if( modifier ==
'k' || modifier ==
'K' )
995 else if( modifier ==
'M' )
997 else if( modifier ==
'G' )
1017 value->Replace( wxS(
" " ), wxEmptyString );
1019 wxChar ambiguousSeparator =
'?';
1020 wxChar thousandsSeparator =
'?';
1021 bool thousandsSeparatorFound =
false;
1022 wxChar decimalSeparator =
'?';
1023 bool decimalSeparatorFound =
false;
1026 for(
int ii = (
int) value->length() - 1; ii >= 0; --ii )
1028 wxChar c = value->GetChar( ii );
1030 if( c >=
'0' && c <=
'9' )
1034 else if( c ==
'.' || c ==
',' )
1036 if( decimalSeparator !=
'?' || thousandsSeparator !=
'?' )
1040 if( c == decimalSeparator )
1042 if( thousandsSeparatorFound )
1044 else if( decimalSeparatorFound )
1047 decimalSeparatorFound =
true;
1049 else if( c == thousandsSeparator )
1054 thousandsSeparatorFound =
true;
1057 else if( ambiguousSeparator !=
'?' )
1061 if( c == ambiguousSeparator )
1064 thousandsSeparator = ambiguousSeparator;
1065 thousandsSeparatorFound =
true;
1066 decimalSeparator = c ==
'.' ?
',' :
'.';
1071 decimalSeparator = ambiguousSeparator;
1072 decimalSeparatorFound =
true;
1073 thousandsSeparator = c;
1074 thousandsSeparatorFound =
true;
1086 if( ( ii == 1 && value->GetChar( 0 ) ==
'0' ) || digits != 3 )
1088 decimalSeparator = c;
1089 decimalSeparatorFound =
true;
1090 thousandsSeparator = c ==
'.' ?
',' :
'.';
1094 ambiguousSeparator = c;
1107 if( decimalSeparator ==
'?' && thousandsSeparator ==
'?' )
1109 const struct lconv* lc = localeconv();
1111 decimalSeparator = lc->decimal_point[0];
1112 thousandsSeparator = decimalSeparator ==
'.' ?
',' :
'.';
1116 value->Replace( thousandsSeparator, wxEmptyString );
1117 value->Replace( decimalSeparator,
'.' );
1130 wxString strFWordBeg, strFWordMid, strFWordEnd;
1131 wxString strSWordBeg, strSWordMid, strSWordEnd;
1134 SplitString( fWord, &strFWordBeg, &strFWordMid, &strFWordEnd );
1135 SplitString( sWord, &strSWordBeg, &strSWordMid, &strSWordEnd );
1138 int isEqual = strFWordBeg.CmpNoCase( strSWordBeg );
1144 else if( isEqual < 0 )
1151 double lFirstNumber = 0;
1152 double lSecondNumber = 0;
1153 bool endingIsModifier =
false;
1160 strFWordMid.ToDouble( &lFirstNumber );
1161 strSWordMid.ToDouble( &lSecondNumber );
1163 endingIsModifier |=
ApplyModifier( lFirstNumber, strFWordEnd );
1164 endingIsModifier |=
ApplyModifier( lSecondNumber, strSWordEnd );
1166 if( lFirstNumber > lSecondNumber )
1168 else if( lFirstNumber < lSecondNumber )
1171 else if( !endingIsModifier )
1172 return strFWordEnd.CmpNoCase( strSWordEnd );
1181 wxString* strBeginning,
1182 wxString* strDigits,
1185 static const wxString separators( wxT(
".," ) );
1188 strBeginning->Empty();
1193 if( strToSplit.length() == 0 )
1199 for( ii = (strToSplit.length() - 1); ii >= 0; ii-- )
1201 if( wxIsdigit( strToSplit[ii] ) )
1208 *strBeginning = strToSplit;
1213 *strEnd = strToSplit.substr( ii + 1 );
1216 int position = ii + 1;
1218 for( ; ii >= 0; ii-- )
1220 if( !wxIsdigit( strToSplit[ii] ) && separators.Find( strToSplit[ii] ) < 0 )
1226 *strDigits = strToSplit.substr( 0, position );
1232 *strDigits = strToSplit.substr( ii + 1, position - ii - 1 );
1233 *strBeginning = strToSplit.substr( 0, ii + 1 );
1247 int index = aStr.Len() - 1;
1251 const char chr = aStr.GetChar( index );
1253 if( chr <
'0' || chr >
'9' )
1256 number += ( chr -
'0' ) * base;
1273 bool changed =
false;
1275 result.reserve( aName->length() );
1277 for( std::string::iterator it = aName->begin(); it != aName->end(); ++it )
1282 StrPrintf( &result,
"%c", aReplaceChar );
1303 bool changed =
false;
1305 result.reserve( aName.Length() );
1308 for( wxString::iterator it = aName.begin(); it != aName.end(); ++it )
1310 if( illWChars.Find( *it ) != wxNOT_FOUND )
1313 result += aReplaceChar;
1315 result += wxString::Format(
"%%%02x", *it );
1332void wxStringSplit(
const wxString& aText, wxArrayString& aStrings, wxChar aSplitter )
1336 for(
unsigned ii = 0; ii < aText.Length(); ii++ )
1338 if( aText[ii] == aSplitter )
1340 aStrings.Add( tmp );
1349 if( !tmp.IsEmpty() )
1350 aStrings.Add( tmp );
1356 struct lconv* lc = localeconv();
1357 char sep = lc->decimal_point[0];
1358 unsigned sep_pos = aStringValue.Find( sep );
1363 unsigned min_len = sep_pos + aTrailingZeroAllowed + 1;
1365 while( aStringValue.Len() > min_len )
1367 if( aStringValue.Last() ==
'0' )
1368 aStringValue.RemoveLast();
1380 if( aValue != 0.0 && std::fabs( aValue ) <= 0.0001 )
1382 buf = fmt::format(
"{:.16f}", aValue );
1385 while( !buf.empty() && buf[buf.size() - 1] ==
'0' )
1392 if( buf[buf.size() - 1] ==
'.' )
1399 buf = fmt::format(
"{:.10g}", aValue );
1411 if( aValue != 0.0 && std::fabs( aValue ) <= 0.0001 )
1415 len = snprintf( buf,
sizeof( buf ),
"%.16f", aValue );
1417 while( --len > 0 && buf[len] ==
'0' )
1420 if( buf[len] ==
'.' || buf[len] ==
',' )
1429 len = snprintf( buf,
sizeof( buf ),
"%.10g", aValue );
1432 return std::string( buf, len );
1439 wxString line = wxString::FromUTF8( cstring );
1441 if( line.IsEmpty() )
1443 line = wxConvCurrent->cMB2WC( cstring );
1445 if( line.IsEmpty() )
1446 line = wxString::From8BitData( cstring );
1456 wxString line = wxString::FromUTF8( aString );
1458 if( line.IsEmpty() )
1460 line = wxConvCurrent->cMB2WC( aString.c_str() );
1462 if( line.IsEmpty() )
1463 line = wxString::From8BitData( aString.c_str() );
1472 wxString uriPathAndFileName;
1474 wxCHECK( aFileUri.StartsWith( wxS(
"file://" ), &uriPathAndFileName ), aFileUri );
1476 wxString tmp = uriPathAndFileName;
1477 wxString retv = wxS(
"file://" );
1479 tmp.Replace( wxS(
"\\" ), wxS(
"/" ) );
1480 tmp.Replace( wxS(
":" ), wxS(
"" ) );
1482 if( !tmp.IsEmpty() && tmp[0] !=
'/' )
1483 tmp = wxS(
"/" ) + tmp;
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
This file contains miscellaneous commonly used macros and functions.
std::optional< V > get_opt(const std::map< wxString, V > &aMap, const wxString &aKey)
int StrPrintf(std::string *result, const char *format,...)
This is like sprintf() but the output is appended to a std::string instead of to a character array.
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
wxString RemoveHTMLTags(const wxString &aInput)
Removes HTML tags from a string.
wxString EscapeHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
bool WildCompareString(const wxString &pattern, const wxString &string_to_tst, bool case_sensitive)
Compare a string against wild card (* and ?) pattern using the usual rules.
wxString ConvertToNewOverbarNotation(const wxString &aOldStr)
Convert the old ~...~ overbar notation to the new ~{...} one.
int GetTrailingInt(const wxString &aStr)
Gets the trailing int, if any, from a string.
wxString UnescapeString(const wxString &aSource)
static const char illegalFileNameChars[]
Illegal file name characters used to ensure file names will be valid on all supported platforms.
wxString LinkifyHTML(wxString aStr)
Wraps links in HTML tags.
bool convertSeparators(wxString *value)
wxString GetIllegalFileNameWxChars()
wxString From_UTF8(const char *cstring)
bool ConvertSmartQuotesAndDashes(wxString *aString)
Convert curly quotes and em/en dashes to straight quotes and dashes.
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
int ReadDelimitedText(wxString *aDest, const char *aSource)
Copy bytes from aSource delimited string segment to aDest wxString.
bool ReplaceIllegalFileNameChars(std::string *aName, int aReplaceChar)
Checks aName for illegal file name characters.
wxString TitleCaps(const wxString &aString)
Capitalize the first letter in each word.
std::string UIDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 We want to avoid scientific ...
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
std::string EscapedUTF8(const wxString &aString)
Return an 8 bit UTF8 string given aString in Unicode form.
char * GetLine(FILE *File, char *Line, int *LineNum, int SizeLine)
Read one line line from aFile.
bool ApplyModifier(double &value, const wxString &aString)
wxString NormalizeFileUri(const wxString &aFileUri)
Normalize file path aFileUri to URI convention.
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
wxString GetISO8601CurrentDateTime()
int ValueStringCompare(const wxString &strFWord, const wxString &strSWord)
Compare strings like the strcmp function but handle numbers and modifiers within the string text corr...
int SplitString(const wxString &strToSplit, wxString *strBeginning, wxString *strDigits, wxString *strEnd)
Break a string into three parts: he alphabetic preamble, the numeric part, and any alphabetic ending.
bool IsFullFileNameValid(const wxString &aFullFilename)
Checks if a full filename is valid, i.e.
void StripTrailingZeros(wxString &aStringValue, unsigned aTrailingZeroAllowed)
Remove trailing zeros from a string containing a converted float number.
char * StrPurge(char *text)
Remove leading and training spaces, tabs and end of line chars in text.
bool NoPrintableChars(const wxString &aString)
Return true if the string is empty or contains only whitespace.
wxString UnescapeHTML(const wxString &aString)
Return a new wxString unescaped from HTML format.
bool IsURL(wxString aStr)
Performs a URL sniff-test on a string.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
ESCAPE_CONTEXT
Escape/Unescape routines to safely encode reserved-characters in various contexts.