* @file FBase_StringConverter.cpp
* @brief This is the implementation for _StringConverter class.
*/
-
-#include <stdlib.h>
#include <new>
#include <FBaseResult.h>
-#include "FBase_StringConverter.h"
#include <FBaseSysLog.h>
-
-
+#include "FBase_StringConverter.h"
+#include "FBaseUtil_IcuConverter.h"
namespace Tizen { namespace Base
{
char*
_StringConverter::CopyToCharArrayN(const wchar_t* pValue)
{
- char* pRet = null;
-
- int len = wcstombs(0, pValue, 0);
- SysTryReturn(NID_BASE, len != -1, null, E_INVALID_ARG, "[%s] Invalid argument is used. Invalid string.",
- GetErrorMessage(E_INVALID_ARG));
-
- pRet = new (std::nothrow) char[len + 1];
- SysTryReturn(NID_BASE, pRet != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
- GetErrorMessage(E_OUT_OF_MEMORY));
-
- len = wcstombs(pRet, pValue, len);
- pRet[len] = 0;
-
- return pRet;
+ return Tizen::Base::Utility::WcharToUtf8N(pValue);
}
}} //Tizen::Base