jirentabu / crashrpt

Automatically exported from code.google.com/p/crashrpt
0 stars 0 forks source link

Need to add more characters to _ReplaceRestrictedXMLCharacters #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
CString CCrashHandler::_ReplaceRestrictedXMLCharacters(CString sText)
{
  CString sResult;

  sResult = sText;
  sResult.Replace(_T("\""), _T("""));
  sResult.Replace(_T("'"), _T("'"));
  sResult.Replace(_T("&"), _T("&")); // new
  sResult.Replace(_T(">"), _T(">")); // new
  sResult.Replace(_T("<"), _T("&lt;")); // new

  return sResult;
}

Original issue reported on code.google.com by gianlu...@gmail.com on 15 May 2010 at 10:02

GoogleCodeExporter commented 9 years ago
You might need to upgrade as you use not the latest version. In the latest 
version
1.2.4 this method looks like the following:

// Helper method that encodes string into UTF-8 and replaces some characters
std::string CCrashHandler::XmlEncodeStr(CString sText)
{  
  strconv_t strconv;

  // Convert to UTF-8 encoding

  LPCSTR pszEncodedStr = strconv.t2utf8(sText);

  // Replace characters restricted by XML
  CString sResult = pszEncodedStr;
  sResult.Replace(_T("&"), _T("&"));
  sResult.Replace(_T("\""), _T("""));
  sResult.Replace(_T("'"), _T("&apos"));  
  sResult.Replace(_T("<"), _T("<"));
    sResult.Replace(_T(">"), _T(">"));

  return std::string(strconv.t2a(sResult));
}

Original comment by zexspect...@gmail.com on 16 May 2010 at 7:16

GoogleCodeExporter commented 9 years ago
Thank you! I was getting the source from the SVN trunk. Is that not the most 
updated
source?

http://crashrpt.googlecode.com/svn/trunk/ ?

Thanks.

Original comment by gianlu...@gmail.com on 16 May 2010 at 11:59

GoogleCodeExporter commented 9 years ago
You can download the latest source and documentation from here
http://code.google.com/p/crashrpt/downloads/list

Original comment by zexspect...@gmail.com on 17 May 2010 at 3:08