Building Microsoft ASP.NET Applications for Mobile Devices, Second Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Building Microsoft ASP.NET Applications for Mobile Devices, Second Edition [Electronic resources] - نسخه متنی

Andy Wigley; Peter Roxburgh

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید






Defining Character Set Encodings

ASP.NET uses Unicode internally and objects such as the String class to ensure that Web applications can operate with any displayable characters. Network entities such as WAP gateways and the client browsers themselves need to know what encoding you've used to transfer the character data across the Web in order to interpret it correctly.

You can define character set encodings in the Web.config file, as shown here:

<configuration>
<system.web>
<globalization
responseEncoding="utf-8"
requestEncoding="utf-8"
fileEncoding="utf-8"
/>
</system.web>
</configuration>

You set the responseEncoding attribute to set the encoding that the server uses to send data to the client—for example, UTF-8. A definition of this attribute also appears in the HTTP headers to inform recipients of the encoding used. You set the requestEncoding attribute to indicate the assumed encoding of incoming requests. The default if not specified is UTF-8. If the client defines an

Accept-Charset value in the HTTP headers sent with the request, the encoding specified in there is used instead of the value you enter in the requestEncoding attribute.

The FileEncoding attribute specifies the encoding that's used to interpret the data included in the .aspx file when the ASP.NET page parser reads it in order to compile it. If you have written string literals into your page that use non-US-ASCII characters (perhaps in setting the Text property of a control), you must save the page to disk using the character encoding that supports those characters. When saving such a file in Visual Studio .NET, you must click the File menu and choose Advanced Save Options. You set the FileEncoding attribute in Web.config to record the encoding used to save the mobile Web Forms page so that when the runtime parses it at run time, it knows what encoding to use to interpret the page.

You can also define character set encodings in the @ Page directive which apply to that page only and override settings in the Web.config file:

<%@ Page ResponseEncoding="utf-8" RequestEncoding="utf-8" …%>





Note

When you're working with multilingual applications, you might find the Microsoft Windows Character Map application useful. To open the Character Map application, click Start and then click Run. Next type charmap in the Open box and click OK. This application offers one way to access characters that aren't available from your keyboard so that you can copy them into files and documents.


/ 145