Esempio n. 1
0
/**
 * Escape the special XML characters and be careful to catch any disallowed control character
 */
QString CheckAndEscapeXmlText(const QString& strText)
{
    QString strReturn(strText);
    QChar ch;

    for (uint i=0; i<strReturn.length(); i++)
    {
        ch = strReturn[i];
        const int test = ch.unicode();

        // The i+= is for the additional characters
        if (test == 38) { strReturn.replace(i, 1, "&amp;"); i+=4; } // &
        else if (test == 60) { strReturn.replace(i, 1, "&lt;"); i+=3; } // <
        else if (test == 62) { strReturn.replace(i, 1, "&gt;"); i+=3; } // >
        else if (test == 34) { strReturn.replace(i, 1, "&quot;"); i+=5; } // "
        else if (test == 39) { strReturn.replace(i, 1, "&apos;"); i+=5; } // '
        else if (test >= 32) continue; // Normal character (from space on)
        else if ((test == 9) || (test == 10) || (test == 13) ) continue; // Allowed control characters: TAB, LF, CR
        else
        {
            // A disallowed control character:
            // - could be a bug in the RTF file
            // - could be not supported encoding.
            // In any case, we must replace this character.
            kDebug(30515) <<"Control character in XML stream:" << test;
            strReturn.replace(i, 1, '?'); // Replacement character
        }
    }

    return strReturn;
}
wxString DatabaseStringConverter::ConvertFromUnicodeStream(const char* inputBuffer, const char* encoding)
{
  wxString strReturn(wxConvUTF8.cMB2WC(inputBuffer), *wxConvCurrent);
  
  // If the UTF-8 conversion didn't return anything, then try the default unicode conversion
  if (strReturn == wxEmptyString)
    strReturn << wxString(inputBuffer, *wxConvCurrent);
  
  return strReturn;
}  
Esempio n. 3
0
		const CString	CWindowsError::GetMessage() const{
			LPCWSTR szMessage = 0;
			if(FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, this->m_dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&szMessage, 1, 0)){
				CString strReturn(szMessage);
				LocalFree((HLOCAL)szMessage);

				return strReturn;
			}

			return L"Error nr " + String::ToString(this->m_dwErrorCode);
		}
Esempio n. 4
0
	///
	/// \brief Fonction qui permet de remplacer toutes les occurences d'une string par une autre
	/// \param[in]		strSource		String source
	/// \param[in]		strFind			String qu'on veut remplacer 
	/// \param[in]		strReplace		String de remplacement
	/// \return							La string strSource sans les encodages html
	///
	std::string String::Replace(const std::string &strSource, const std::string &strFind, const std::string &strReplace)
	{
		std::string strReturn(strSource);
		unsigned int pos=0;
		while((pos=strReturn.find(strFind, pos))!=std::string::npos)
		{
			strReturn.replace(pos, strFind.size(),strReplace);
			pos+=strReplace.size();
		}
		return strReturn;
	}
Esempio n. 5
0
std::string WStringToUTF8(const wchar_t* lpwcszWString)
{
	char* pElementText;
	int iTextLen = ::WideCharToMultiByte(CP_UTF8, 0, (LPWSTR)lpwcszWString, -1, NULL, 0, NULL, NULL);
	pElementText = new char[iTextLen + 1];
	memset((void*)pElementText, 0, (iTextLen + 1) * sizeof(char));
	::WideCharToMultiByte(CP_UTF8, 0, (LPWSTR)lpwcszWString, -1, pElementText, iTextLen, NULL, NULL);
	std::string strReturn(pElementText);
	delete [] pElementText;
	return strReturn;
}
Esempio n. 6
0
std::string ProtocolSartano::getStringForCode(const std::wstring &strCode, int method) {
	std::string strReturn("S");

	for (size_t i = 0; i < strCode.length(); ++i) {
		if (strCode[i] == L'1') {
			strReturn.append("$k$k");
		} else {
			strReturn.append("$kk$");
		}
	}

	if (method == TELLSTICK_TURNON) {
		strReturn.append("$k$k$kk$$k+");
	} else if (method == TELLSTICK_TURNOFF) {
		strReturn.append("$kk$$k$k$k+");
	} else {
		return "";
	}

	return strReturn;
}
Esempio n. 7
0
	///
	/// \brief Fonction qui remplace les encodages html
	/// \param[in]		strSource		String source
	/// \return							La string strSource sans les encodages html
	///
	std::string HtmlDecode(const std::string &strSource)
	{
		std::string strReturn(strSource);
		if(Utils::String::Contains(strReturn, ";")) //TODO:remplacer par Regex avec & ;
		{
			//Décodage des principaux caractère de la langue française
			//Ajout au besoin
			//http://www.ascii.cl/htmlcodes.htm
			strReturn=Utils::String::Replace(strReturn, "&agrave;", "à");
			strReturn=Utils::String::Replace(strReturn, "&aacute;", "á");
			strReturn=Utils::String::Replace(strReturn, "&acirc;", "â");
			strReturn=Utils::String::Replace(strReturn, "&auml;", "ä");
			strReturn=Utils::String::Replace(strReturn, "&egrave;", "è");
			strReturn=Utils::String::Replace(strReturn, "&eacute;", "é");
			strReturn=Utils::String::Replace(strReturn, "&ecirc;", "ê");
			strReturn=Utils::String::Replace(strReturn, "&euml;", "ë");
			strReturn=Utils::String::Replace(strReturn, "&igrave;", "ì");
			strReturn=Utils::String::Replace(strReturn, "&iacute;", "í");
			strReturn=Utils::String::Replace(strReturn, "&icirc;", "î");
			strReturn=Utils::String::Replace(strReturn, "&iuml;", "ï");
			strReturn=Utils::String::Replace(strReturn, "&ograve", "ò");
			strReturn=Utils::String::Replace(strReturn, "&oacute;", "ó");
			strReturn=Utils::String::Replace(strReturn, "&ocirc;", "ô");
			strReturn=Utils::String::Replace(strReturn, "&ouml;", "ö");
			strReturn=Utils::String::Replace(strReturn, "&ugrave", "ù");
			strReturn=Utils::String::Replace(strReturn, "&uacute;", "ú");
			strReturn=Utils::String::Replace(strReturn, "&ucirc;", "û");
			strReturn=Utils::String::Replace(strReturn, "&uuml;", "ü");
			strReturn=Utils::String::Replace(strReturn, "&ccedil;", "ç");
			strReturn=Utils::String::Replace(strReturn, "&nbsp;", " ");
			
			//Version Majuscule
			strReturn=Utils::String::Replace(strReturn, "&Agrave;", "À");
			strReturn=Utils::String::Replace(strReturn, "&Aacute;", "Á");
			strReturn=Utils::String::Replace(strReturn, "&Acirc;", "Â");
			strReturn=Utils::String::Replace(strReturn, "&Auml;", "Ä");
			strReturn=Utils::String::Replace(strReturn, "&Egrave;", "È");
			strReturn=Utils::String::Replace(strReturn, "&Eacute;", "É");
			strReturn=Utils::String::Replace(strReturn, "&Ecirc;", "Ê");
			strReturn=Utils::String::Replace(strReturn, "&Euml;", "Ë");
			strReturn=Utils::String::Replace(strReturn, "&Igrave;", "Ì");
			strReturn=Utils::String::Replace(strReturn, "&Iacute;", "Í");
			strReturn=Utils::String::Replace(strReturn, "&Icirc;", "Î");
			strReturn=Utils::String::Replace(strReturn, "&Iuml;", "Ï");
			strReturn=Utils::String::Replace(strReturn, "&Ograve", "Ò");
			strReturn=Utils::String::Replace(strReturn, "&Oacute;", "Ó");
			strReturn=Utils::String::Replace(strReturn, "&Ocirc;", "Ô");
			strReturn=Utils::String::Replace(strReturn, "&Ouml;", "Ö");
			strReturn=Utils::String::Replace(strReturn, "&Ugrave", "Ù");
			strReturn=Utils::String::Replace(strReturn, "&Uacute;", "Ú");
			strReturn=Utils::String::Replace(strReturn, "&Ucirc;", "Û");
			strReturn=Utils::String::Replace(strReturn, "&Uuml;", "Ü");
			strReturn=Utils::String::Replace(strReturn, "&Ccedil;", "Ç");
			strReturn=Utils::String::Replace(strReturn, "&nbsp;","");
			strReturn=Utils::String::Replace(strReturn, "&#234;","ê");
			strReturn=Utils::String::Replace(strReturn, "&#233;","é");
			strReturn=Utils::String::Replace(strReturn, "&#235;","ë");
			strReturn=Utils::String::Replace(strReturn, "&#226;","â");
			strReturn=Utils::String::Replace(strReturn, "&#244;","ô");
			strReturn=Utils::String::Replace(strReturn, "&mdash;","-");

		}
		if(Utils::String::Contains(strReturn, "Ã"))
		{
			strReturn=Utils::String::Replace(strReturn, "ô", "ô");	
			strReturn=Utils::String::Replace(strReturn, "ê", "ê");	
			strReturn=Utils::String::Replace(strReturn, "â", "â");			
			strReturn=Utils::String::Replace(strReturn, "é", "é");			
			strReturn=Utils::String::Replace(strReturn, "ë", "ë");					
			strReturn=Utils::String::Replace(strReturn, "è", "è");			
			strReturn=Utils::String::Replace(strReturn, "à", "à");			
			strReturn=Utils::String::Replace(strReturn, "ç", "ç");			
			strReturn=Utils::String::Replace(strReturn, "Â", "Â");			
			strReturn=Utils::String::Replace(strReturn, "À", "À");			
			strReturn=Utils::String::Replace(strReturn, "É", "É");					
			strReturn=Utils::String::Replace(strReturn, "Ê", "Ê");			
			strReturn=Utils::String::Replace(strReturn, "ÃŽ", "Î");	
		}
		if(Utils::String::Contains(strReturn, "â"))
		{
			strReturn=Utils::String::Replace(strReturn, "–", "-");
		}


		
		return strReturn;
	}
// Uppercases the specified string.
CString CTemplateFormater::FormatUpper(const CString& szSource)
{
	CString strReturn(szSource);
	strReturn.MakeUpper();
	return strReturn;
};
Esempio n. 9
0
std::string URLEncode(const std::string str)
{
   std::string strReturn(str);
   Replace(strReturn, ";", "%3B");
   return strReturn;
}
Esempio n. 10
0
int CTranCmn::fnAPP_SelectMenu()
{
	CString strReturn("");

	return T_OK;
}
Esempio n. 11
0
int	CTranCmn::fnAPP_IBK_MANAGEMENT_InputProc()
{
	CString	ManagerOpPassword("00000000");
	CString	KtLinKusOpPassword("0000");
	CString strReturn("");
	CString strTmp("");
	int		nGetCnt = 0;
	CString	strAcceptLen("0");
/////////////////////////////////////////////////////////////////////////////
	Accept.AuthFlag = 0;
/////////////////////////////////////////////////////////////////////////////

	m_pDevCmn->fnSCR_DisplayScreen(3200, K_30_WAIT, PIN_MENU_MODE1);				// 환경 업체선택
	strReturn = m_pDevCmn->fstrSCR_GetKeyString();
	if (strReturn == "NICE")
	{
		ManagerOpPassword.Format("%8.8s", GetDate());	
		Accept.AuthFlag = 1;
		strAcceptLen = "8";
	}
	else
	if (strReturn == "KT LINKUS")
	{
		KtLinKusOpPassword = "******";
		Accept.AuthFlag = 2;
		strAcceptLen = "4";
	}
	else
	if (strReturn == S_CANCEL)
		fnAPP_CancelProc(T_CANCEL);
	else
	if (strReturn == S_CANCEL)
		fnAPP_CancelProc(T_CANCEL);
	else
	if (strReturn == S_TIMEOVER)
		fnAPP_CancelProc(T_TIMEOVER);
	else
	if (strReturn == S_INPUTOVER)
		fnAPP_CancelProc(T_INPUTOVER);
	else
	{
		fnAPP_CancelProc(T_INPUTOVER);
	}



	while (TRUE)
	{
		if(nGetCnt > 2) fnAPP_CancelProc(T_INPUTOVER);
		m_pDevCmn->fnSCR_DisplayString(1, strAcceptLen); //	#0115
		m_pDevCmn->fnSCR_DisplayScreen(3202, K_30_WAIT, PIN_NUMERIC_MODE);
		strReturn = m_pDevCmn->fstrSCR_GetKeyString();
		if (strReturn == S_CANCEL)
			fnAPP_CancelProc(T_CANCEL);
		else
		if (strReturn == S_TIMEOVER)
			fnAPP_CancelProc(T_TIMEOVER);
		else
		if (strReturn == S_INPUTOVER)
			fnAPP_CancelProc(T_INPUTOVER);
		else
		if (strReturn == S_CLEAR)
		{
			nGetCnt++;
			continue;
		}
		else
		{
			if (Accept.AuthFlag == 2)
			{
				if (strReturn == KtLinKusOpPassword)
				{
					break;
				}
				else 
				{
					nGetCnt++;
					continue;
				}
			
			}
			else
			{
				if (strReturn == ManagerOpPassword)
				{
					break;
				}
				else 
				{
					nGetCnt++;
					continue;
				}
			}
			
		}
	}
	

	strReturn = "";
/////////////////////////////////////////////////////////////////////////////
	memset(Accept.JiroElecNum, '0', sizeof(Accept.JiroElecNum));		   // 환경점검내용
/////////////////////////////////////////////////////////////////////////////
    //#N0214
	strTmp = IniGetStr(_TRANS_INI, TRANS_SEC, "IBK_MANAGEMENT_INFO","00000000000000");	//#N0199  환경점검 이전 내용 표시
	
	//#N0213 환경점검 시 초기 상태 무조건 비정상
	//strTmp = "11111111111111"; //#N0214
	m_pDevCmn->fnSCR_DisplayString(1, strTmp);

	m_pDevCmn->fnSCR_DisplayScreen(3201, K_120_WAIT, PIN_MENU_MODE1);				// 환경점검내용
	strReturn = m_pDevCmn->fstrSCR_GetKeyString();
	if (strReturn == S_CANCEL)
		fnAPP_CancelProc(T_CANCEL);
	else
	if (strReturn == S_CANCEL)
		fnAPP_CancelProc(T_CANCEL);
	else
	if (strReturn == S_TIMEOVER)
		fnAPP_CancelProc(T_TIMEOVER);
	else
	if (strReturn == S_INPUTOVER)
		fnAPP_CancelProc(T_INPUTOVER);
	else
	if ((strReturn.GetLength() != 14)	||	// 자료검증
		(!IsNum(strReturn.GetBuffer(0), strReturn.GetLength()))	)		
		fnAPP_CancelProc(T_INPUTERROR);
	else
	{
		Accept.JiroElecNumSize = strReturn.GetLength();
		memcpy(Accept.JiroElecNum, strReturn.GetBuffer(0), strReturn.GetLength());

		strTmp.Empty();
		strTmp = strReturn;
		IniSetStr(_TRANS_INI, TRANS_SEC, "IBK_MANAGEMENT_INFO", strReturn.GetBuffer(0)); //#N0199  환경점검 이전 내용 표시 -> #N0214
	}


	strReturn = "";
/////////////////////////////////////////////////////////////////////////////
	Accept.TelNumSize = 0;									// 직원번호 
	memset(Accept.TelNum, ' ', sizeof(Accept.TelNum));		// 직원번호 
/////////////////////////////////////////////////////////////////////////////
		
	m_pDevCmn->fnSCR_DisplayScreen(3203, K_30_WAIT, PIN_NUMERIC_MODE); //// 직원번호 
	strReturn = m_pDevCmn->fstrSCR_GetKeyString();
	if (strReturn == S_CANCEL)
		fnAPP_CancelProc(T_CANCEL);
	else
	if (strReturn == S_CANCEL)
		fnAPP_CancelProc(T_CANCEL);
	else
	if (strReturn == S_TIMEOVER)
		fnAPP_CancelProc(T_TIMEOVER);
	else
	if (strReturn == S_INPUTOVER)
		fnAPP_CancelProc(T_INPUTOVER);
	else
	if ((!strReturn.GetLength())	||							// 자료검증
		(strReturn.GetLength() > sizeof(Accept.TelNum))	||
		(!IsNum(strReturn.GetBuffer(0), strReturn.GetLength()))	||		
		(IsZero(strReturn.GetBuffer(0), strReturn.GetLength())))
		fnAPP_CancelProc(T_INPUTERROR);
	else
	{
		Accept.TelNumSize = strReturn.GetLength();
		memcpy(Accept.TelNum, strReturn.GetBuffer(0), strReturn.GetLength());
		IniSetStr(_TRANS_INI, TRANS_SEC, "IBK_MANAGEMENT_INFO", strTmp); //#N0199  환경점검 이전 내용 표시
	}
	

	return T_OK;
}