[Klone-users] Display unicode
thomas fossati
tho at koanlogic.com
Fri Mar 7 04:04:14 EST 2008
Hi Tran,
On Mar 7, 2008, at 8:13 AM, Trung, Tran Minh wrote:
> Hi,
>
> I have done demo with some ways you showed, but it can not read my
> Unicode file exactly. So I send you my demo klapp. Would you tell me
> what is wrong !?
have you tried displaying 'message' using 'printf("%ls\n",
message);' ? If it works with printf(), it shall work with
io_printf() too.
As a test I've written this sample page:
<%!
#include <stdio.h>
#include <wchar.h>
#include <locale.h>
%>
<html>
<head>
<title>test unicode</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
wchar_t message[] = {1040, 1041, 1042, 0};
setlocale(LC_CTYPE, "UTF-8");
io_printf(out, "%ls", message);
%>
</body>
</html>
Note the explicit setlocale() and the "%ls" as fmt string to
io_printf(), which displays pretty well on different browsers.
Hope it helps.
ciao, t.
More information about the klone-users
mailing list