RTC Forums

Subscription => Support => Topic started by: xalion on December 17, 2012, 11:21:24 AM



Title: how to display chinese in browser.
Post by: xalion on December 17, 2012, 11:21:24 AM
 with Sender as TRtcDataServer do
    if Request.Complete then
      begin
      Write('你好');

      end;

when I open in browser, it display ??.

how to  display chinese in browser?


Title: Re: how to display chinese in browser.
Post by: D.Tkalcec (RTC) on December 17, 2012, 11:32:21 AM
You can not send Unicode characters out directly with the Write method. You need to properly encode your Unicode content. If you are using UTF-8 encoding, you can do it by using the function Utf8Encode (returns encoded String) or Utf8EncodeEx (returns encoded byte array).

For example:

with Sender as TRtcDataServer do
    if Request.Complete then
      begin
      WriteEx( Utf8EncodeEx( '你好' ) );
      end;

Another way would be to use HTML escape sequences with character codes. In that case, the encoding of your HTML page is not important.

Best Regards,
Danijel Tkalce


Title: Re: how to display chinese in browser.
Post by: xalion on December 17, 2012, 02:24:31 PM
Thank you. it works now.