Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology
Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered
You are not logged in.
Pages: 1
my flash ui call pass a chinese words to scol,
then i use dailog box and debug console to display that words,
but the reasult is like this:
\198\223\292\198
how to convert it to factual string? is there any function I missed?
Last edited by kenshin1987 (13-Feb-2011 00:07:46)
Offline
wooh ...
i remember that scol could manage chinese language, but flash seem's to send unicode ?!
is other interface manage correctly chinese language ? (in dialog box title for example)
another cause could be a missed conversion in hikari flash call
Offline
wooh ...
i remember that scol could manage chinese language, but flash seem's to send unicode ?!
is other interface manage correctly chinese language ? (in dialog box title for example)
another cause could be a missed conversion in hikari flash call
other interface like dialogbox can display chinese correctly,
somewhere in scol trun the chinese string to \xxx\xxx\xxx\xxx
fun cbGetMessage(flashctrl, constr, message, args)=
_DMSevent this (getPluginInstanceEvent constr.FLINT_instance message) (listToString args) nil;
0;;
after function listToString the value changed...
Last edited by kenshin1987 (12-Feb-2011 20:45:42)
Offline
fun listToString(l)=
let nil -> ret in
(
let sizelist l -> size in
let 0 -> i in
while (i < size) do
(
let nth_list l i -> line in
let strextr line -> lp in
set ret = lcat ret (hd lp)::nil;
set i = i + 1;
);
if ret == nil then nil else strbuild ret;
);;
Offline
strbuild is a Scol function, in the standard library. But i see already some similars problems (with a french or english language). The reason was a bad formatted string at the entry.
Here, it may be the contain of the list ...
strbuild / strextr works the same way.
Are you tested "args" in cbGetMessage ?
However, Arkeon knows the os3d better than me, so wait his response.
Offline
problem come from here,
the flash interface plugint when recieve the message form flash
fun cbGetMessage(flashctrl, constr, message, args)=
_DMSevent this (getPluginInstanceEvent constr.FLINT_instance message) (listToString args) nil;
0;;
it will call listToString function and this function will call strbuild.
strbuild will convert unicode word to \xxx\xxx\xxx\xxx format
so if I use strextr before show dialog,string display correct.
let hd hd (strextr message) -> message in
but this is only display the first word...
so we need use strcatn replace the listToString
Last edited by kenshin1987 (13-Feb-2011 00:28:38)
Offline
Ok !
Do you just need the first element (hd strextr message) ? Not strextr message ?
strcatn take a [S r1] as argument, not [[S r1] r1]
Thanks to your work
Offline
oups i didn't see your responses ... i was working on 3D sounds (done) ...
the strbuild function made me crazy several times ...
i already rewrite the listToString function but in some cases the strbuild is needed
kenshin could you send me by mail your flash interface with an xos file using it ?
Offline
ok,no problem
Offline
could you try this instead ?
fun listToString(l)=
let nil -> ret in
(
let sizelist l -> size in
let 0 -> i in
while (i < size) do
(
let nth_list l i -> line in
let strextr line -> lp in
set ret = lcat ret (strcatnSep (hd lp) " ")::nil;
set i = i + 1;
);
if ret == nil then nil else strcatnSep ret "\n";
);;
I changed my system language to japanese to test but text input don't seem's to work for me
Offline
hi,arkeon
you use mbstowcs and wcstombs function to convert the string and wstring,not enough ,also should set setlocale(LC_ALL, "chs");.
but you can choose another way
like
std::wstring Ansi2WChar(LPCSTR pszSrc, int nLen)
{
int nSize = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszSrc, nLen, 0, 0);
if(nSize <= 0) return NULL;
WCHAR *pwszDst = new WCHAR[nSize+1];
if( NULL == pwszDst) return NULL;
MultiByteToWideChar(CP_ACP, 0,(LPCSTR)pszSrc, nLen, pwszDst, nSize);
pwszDst[nSize] = 0;
if( pwszDst[0] == 0xFEFF) // skip Oxfeff
for(int i = 0; i < nSize; i ++)
pwszDst[i] = pwszDst[i+1];
wstring wcharString(pwszDst);
delete pwszDst;
return wcharString;
}
std::wstring s2ws(const string& s){ return Ansi2WChar(s.c_str(),s.size());}
std::string WChar2Ansi(LPCWSTR pwszSrc)
{
int nLen = WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, NULL, 0, NULL, NULL);
if (nLen<= 0) return std::string("");
char* pszDst = new char[nLen];
if (NULL == pszDst) return std::string("");
WideCharToMultiByte(CP_ACP, 0, pwszSrc, -1, pszDst, nLen, NULL, NULL);
pszDst[nLen -1] = 0;
std::string strTemp(pszDst);
delete [] pszDst;
return strTemp;
}
string ws2s(wstring& inputws){ return WChar2Ansi(inputws.c_str()); }
and about the flash keyborad input:
void FlashControl::handleKeyEvent(UINT msg, WPARAM wParam, LPARAM lParam)
{
LRESULT aResult;
if(msg == WM_CHAR)
{
if(wParam > 0x7F)
{
if(!__mbr_enable)
{
__mbr_enable = true;
__mbr_save_w = wParam;
__mbr_save_l = lParam;
}
else
{
__mbr_enable = false;
windowlessObject->OnWindowMessage(msg, wParam, lParam, &aResult);
windowlessObject->OnWindowMessage(msg, __mbr_save_w,__mbr_save_l, &aResult);
}
}
else
{
__mbr_enable = false;
windowlessObject->OnWindowMessage(msg, wParam, lParam, &aResult);
}
}
else
windowlessObject->OnWindowMessage(msg, wParam, lParam, &aResult);
}
because the code
fact input :中文测试 : d6 d0 ce c4 b2 e2 ca d4
displayed :兄奈獠允 : d0 d6 c4 ce e2 b2 d4 ca
this is why everything happening.when windows decide to transfer a unicode character,it will send two WM_CHAR to the target window,first the lower two bytes,then the higher two bytes.maybe this is windows needed,but it seems the flash player doesn`t think so.so what we have to do is quite simple.we should reverse the two WM_CHAR messages before they were sent to flash player activex.we will need some hacking on our Hikari.in the FlashControl::handleKeyEvent,we join a procedure before calling windowlessObject->OnWindowMessage.we pick the WM_CHAR message,then check the wParam,if it`s not an ascii character,then we do something discussed above,else we just pass it.
Offline
Yes ! We already talked about that on the old Scolring. It's an important work to do. At this time, no localization exists in Scol. It's a really problem if a language is not latin encoded, there may be undefined behaviors. There are a lot of things to do on the strings. I note that to do some tests with y lib "TEST".
If needed, my "bible" : http://www.linuxcertif.com/man/3/setlocale/ (fr, en, ...)
setlocale is C89 and Posix. It's standard and portable.
In these sources, there are some exmaples / uses : newtonsdk, ogre3d, ... See the redmine.
Good luck
Offline
Seems that you use the "old" FlashControl class.
We will have to test if it's ok with the new one (SFlashWidget)...
Nodrev
Offline
Pages: 1