/* 컨버팅 함수 만들었다.*/
int ConvertMorkStrToUnicode(const char* strIN, char *strOut, size_t outsize)
{
ASSERT(strIN);
int len = (int)strlen(strIN);
if (len > (int)outsize)
return -1;
int from=0, to=0;
char ch, cHigh, cLow;
while(len>from)
{
ch = strIN[from++];
switch(ch)
{
case 0x24: // '$': escape the next two hex bytes which encode a single octet
{
cHigh = strIN[from++];
cLow = strIN[from++];
cHigh = cHigh > 0x40 ? cHigh%0x37 : cHigh%0x30;
cLow = cLow > 0x40 ? cLow%0x37 : cLow%0x30;
strOut[to++] = cHigh << 4 | cLow;
continue;
}
break;
case 0x5c: // '\\'
{
// CR,LF(#xD, #xA)
if (strIN[from] == 0x0d && strIN[from+1] == 0x0a) // escape line ending
{
from+=2;
continue;
}
ch = strIN[from++];
}
break;
case 0x29: // ')' End of literal
continue;
default:
break;
}
strOut[to++] = ch;
};
// terminate to null
strOut[to] = strOut[to+1] = 0;
return to;
}


