RTC Forums
November 24, 2024, 07:39:07 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: how to display chinese in browser.  (Read 4478 times)
xalion
RTC Expired
*
Posts: 6


« 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?
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 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
Logged
xalion
RTC Expired
*
Posts: 6


« Reply #2 on: December 17, 2012, 02:24:31 PM »

Thank you. it works now.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 17 queries.