[Klone-users] Unicode display

thomas fossati tho at koanlogic.com
Thu Mar 6 08:55:04 EST 2008


On Mar 6, 2008, at 2:33 PM, Stefano Barbato wrote:
> Hi,
>
> you can write out the whole Unicode file loading it in a buffer and  
> printing it with io_write:
>
>
> ---[ index.kl1 ]---
> <body>
>
> <%
>  char *buf = NULL;
>  size_t size;
>
>  if(u_load_file("/path/to/the/text/file.txt", 0, &buf, &size) == 0)
>  {
>      io_write(out, buf, size);
>      u_free(buf); buf = NULL;
>  }
> %>
>
> </body>
> -------------------
>
> for more info on u_load_file go to http://www.koanlogic.com/libu/api/html/group__misc.html#ga15

also, setting explicitly the <meta http-equiv="Content-Type"  
content="text/html; charset=UTF-8"/> can aid on some browsers, e.g:

<html>
<head>
     <meta http-equiv="Content-Type" content="text/html;  
charset=UTF-8"/>
</head>
<body>
<%
     const char *s = "Internet &#273;ang nga&#768;y ca&#768;ng  
ta&#769;c ...";

     io_printf(out, s, strlen(s));
%>
</body>
</html>

displays ok on both Firefox and Safari.

ciao, t.




More information about the klone-users mailing list