UNI code的Hello World页 [英] Unicode Hello World Page
问题描述
有人告诉我说,产生单codeD网页一个简单的ASP脚本?也许你可以在各种语言书写世界,你好。
Can someone show me a simple ASP script that produces a unicoded webpage? Maybe you could write Hello world in a variety of languages.
另外我怎么能转换成花车为字符串,这样我可以生产出2.3或2,3,这取决于该国的页面被定向到。是否ASP提供的功能这样做?
Also how can I convert floats to string so that I can produce "2.3" or "2,3" depending on the country the page is being directed to. Does ASP offer functionality for doing this?
此外,你怎么转换AB
到。急症室; NBSP; B
等
谢谢,
巴里
推荐答案
有两个部分在创造一个真正的统一code(UTF-8)页面。首先,你需要将数据输出为UTF-8。要指示Web服务器使用UTF-8,把这个线在你的ASP文件的顶部。
Unicode:
There are two parts in creating a true Unicode (utf-8) page. First you will need to output the data as utf-8. To instruct the web server to use utf-8, put this line at the top of your asp-file.
<%
response.codepage = 65001
response.charset = "utf-8" '//This information is intended for the browser.
%>
其次,你需要告诉你所使用的编码器。将这个信息的HTML头标记。
Secondly, you'll need to tell the browser which encoding you are using. Put this information the html head tag.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
请记住,硬codeD文本(在ASP文件)将被输出的原样,所以将文件保存在磁盘上的UTF-8。
Remember that hard-coded text (in an ASP-file) will be outputted "as is", therefore save the file as utf-8 on disk.
的还我怎么能转换成花车为字符串,这样我可以生产出2.3或2,3,这取决于该国的页面被定向到。是否ASP提供的功能这样做?的
使用LCID改变如何日期,数字,货币等格式。 在这里阅读更多!
Use LCID to change how dates, numbers, currency etc is formatted. Read more here!
<%
Session.LCID = 1053 'Swedish dateformat (and number format)
%>
HTML编码:
的此外,你怎么转换成A B到A&NBSP; B。等等的
这是很容易的。只要使用Server.HTMLEn code(串)
This is very easy. Just use Server.HTMLEncode(string)
<%
Server.HTMLEncode("A B") '//Will output A B
%>
示例页面:
<%
'//This page is encoded as utf-8
response.codepage = 65001
response.charset = "utf-8"
'//We use the swedish locale so that dates and numbers display nicely
Session.LCID = 1053 '//Swedish
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<%
Server.HTMLEncode("Hello world!") '//English
Server.HTMLEncode("Hej världen!") '//Swedish
Server.HTMLEncode("Γεια σου κόσμε!") '//Greek
Server.HTMLEncode("!سلام دنیا") '//Persian
%>
</body>
</html>
这篇关于UNI code的Hello World页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!