Sideway
output.to from Sideway
Draft for Information Only

Content

Session Object
 Session.CodePage Property
   Syntax:
   Parameters:
   Remarks:
   Examples:

Session Object

Another important function of Session object is the control of ASP engine for the HTML output.

Session.CodePage Property

Response.CodePage property Add or set the CodePage for data in the intrinsic objects within the entire session.

Syntax:

Session.CodePage(=CodePageID)

 Or in an ASP file. Imply

<% Response.CodePage(=CodePageID) %>

Parameters:

CodePageID

The parameter "CodePageID" is the page code to represent the character code formatting used for the HTML output. The data type of "CodePageID" is integer. The possible CodePageID are

Family
Code Page
Code Page Charset
1256 708 Arabic (ASMO 708); ASMO-708
720 Arabic (DOS); DOS-720
28596 Arabic (ISO); iso-8859-6
10004 Arabic (Mac); x-mac-arabic
1256 Arabic (Windows); windows-1256
1257 775 Baltic (DOS); ibm775
28594 Baltic (ISO); iso-8859-4
1257 Baltic (Windows); windows-1257
1250 852 Central European (DOS); ibm852
28592 Central European (ISO); iso-8859-2
10029 Central European (Mac); x-mac-ce
1250 Central European (Windows); windows-1250
870 IBM EBCDIC (Multilingual Latin-2); CP870
936 51936 Chinese Simplified (EUC); EUC-CN
936 Chinese Simplified (GB2312); gb2312
52936 Chinese Simplified (HZ); hz-gb-2312
10008 Chinese Simplified (Mac); x-mac-chinesesimp
50935 IBM EBCDIC (Simplified Chinese); x-EBCDIC-SimplifiedChinese
950 950 Chinese Traditional (Big5); big5
20000 Chinese Traditional (CNS)/x-Chinese-CNS
20002 Chinese Traditional (Eten); x-Chinese-Eten
10002 Chinese Traditional (Mac); x-mac-chinesetrad
50937 IBM EBCDIC (Traditional Chinese); x-EBCDIC-TraditionalChinese
1251 866 Cyrillic (DOS); cp866
28595 Cyrillic (ISO); iso-8859-5
20866 Cyrillic (KOI8-R); koi8-r
21866 Cyrillic (KOI8-U); koi8-u
10007 Cyrillic (Mac); x-mac-cyrillic
1251 Cyrillic (Windows); windows-1251
20880 IBM EBCDIC (Cyrillic Russian); x-EBCDIC-CyrillicRussian
21025 IBM EBCDIC (Cyrillic Serbian-Bulgarian); x-EBCDIC-CyrillicSerbianBulgarian
1252 29001 Europa; x-Europa
20106 German (IA5); x-IA5-German
20277 IBM EBCDIC (Denmark-Norway); x-EBCDIC-DenmarkNorway
1142 IBM EBCDIC (Denmark-Norway-Euro); x-ebcdic-denmarknorway-euro
20278 IBM EBCDIC (Finland-Sweden); x-EBCDIC-FinlandSweden
1143 IBM EBCDIC (Finland-Sweden-Euro); x-ebcdic-finlandsweden-euro
1147 IBM EBCDIC (France-Euro); x-ebcdic-france-euro
20273 IBM EBCDIC (Germany); x-EBCDIC-Germany
1141 IBM EBCDIC (Germany-Euro); x-ebcdic-germany-euro
20871 IBM EBCDIC (Icelandic); x-EBCDIC-Icelandic
1149 IBM EBCDIC (Icelandic-Euro); x-ebcdic-icelandic-euro
1148 IBM EBCDIC (International-Euro); x-ebcdic-international-euro
20280 IBM EBCDIC (Italy); x-EBCDIC-Italy
1144 IBM EBCDIC (Italy-Euro); x-ebcdic-italy-euro
20284 IBM EBCDIC (Spain); X-EBCDIC-Spain
1145 IBM EBCDIC (Spain-Euro); x-ebcdic-spain-euro
20285 IBM EBCDIC (UK); x-EBCDIC-UK
1146 IBM EBCDIC (UK-Euro); x-ebcdic-uk-euro
37 IBM EBCDIC (US-Canada); ebcdic-cp-us
1140 IBM EBCDIC (US-Canada-Euro); x-ebcdic-cp-us-euro
861 Icelandic (DOS); ibm861
10079 Icelandic (Mac); x-mac-icelandic
28605 Latin 9 (ISO); iso-8859-15
20108 Norwegian (IA5); x-IA5-Norwegian
437 OEM United States; IBM437
20107 Swedish (IA5); x-IA5-Swedish
20127 US-ASCII; us-ascii
850 Western European (DOS); ibm850
20105 Western European (IA5); x-IA5
28591 Western European (ISO); iso-8859-1
10000 Western European (Mac); macintosh
1252 Western European (Windows); Windows-1252
1253 737 Greek (DOS); ibm737
28597 Greek (ISO); iso-8859-7
10006 Greek (Mac); x-mac-greek
1253 Greek (Windows); windows-1253
869 Greek, Modern (DOS); ibm869
875 IBM EBCDIC (Greek Modern); x-EBCDIC-GreekModern
20423 IBM EBCDIC (Greek); x-EBCDIC-Greek
1255 862 Hebrew (DOS); DOS-862
38598 Hebrew (ISO-Logical); iso-8859-8-i
28598 Hebrew (ISO-Visual); iso-8859-8
10005 Hebrew (Mac); x-mac-hebrew
1255 Hebrew (Windows); windows-1255
20424 IBM EBCDIC (Hebrew); x-EBCDIC-Hebrew
1256 20420 IBM EBCDIC (Arabic); x-EBCDIC-Arabic
932 50930 IBM EBCDIC (Japanese and Japanese Katakana); x-EBCDIC-JapaneseAndKana
50939 IBM EBCDIC (Japanese and Japanese-Latin); x-EBCDIC-JapaneseAndJapaneseLatin
50931 IBM EBCDIC (Japanese and US-Canada); x-EBCDIC-JapaneseAndUSCanada
20290 IBM EBCDIC (Japanese katakana); x-EBCDIC-JapaneseKatakana
51932 Japanese (EUC); euc-jp
50220 Japanese (JIS); iso-2022-jp
50222 Japanese (JIS-Allow 1 byte Kana - SO/SI); iso-2022-jp
50221 Japanese (JIS-Allow 1 byte Kana); csISO2022JP
10001 Japanese (Mac); x-mac-japanese
932 Japanese (Shift-JIS); shift_jis
949 50933 IBM EBCDIC (Korean and Korean Extended); x-EBCDIC-KoreanAndKoreanExtended
20833 IBM EBCDIC (Korean Extended); x-EBCDIC-KoreanExtended
949 Korean; ks_c_5601-1987
51949 Korean (EUC); euc-kr
50225 Korean (ISO); iso-2022-kr
10003 Korean (Mac); x-mac-korean
874 20838 IBM EBCDIC (Thai); x-EBCDIC-Thai
874 Thai (Windows); windows-874
1254 1026 IBM EBCDIC (Turkish Latin-5); CP1026
20905 IBM EBCDIC (Turkish); x-EBCDIC-Turkish
28593 Latin 3 (ISO); iso-8859-3
857 Turkish (DOS); ibm857
28599 Turkish (ISO); iso-8859-9
10081 Turkish (Mac); x-mac-turkish
1254 Turkish (Windows); windows-1254
57006 57006 ISCII Assamese; x-iscii-as
57003 57003 ISCII Bengali; x-iscii-be
57002 57002 ISCII Devanagari; x-iscii-de
57010 57010 ISCII Gujarathi; x-iscii-gu
57008 57008 ISCII Kannada; x-iscii-ka
57009 57009 ISCII Malayalam; x-iscii-ma
57007 57007 ISCII Oriya; x-iscii-or
57011 57011 ISCII Panjabi; x-iscii-pa
57004 57004 ISCII Tamil; x-iscii-ta
57005 57005 ISCII Telugu; x-iscii-te
1361 1361 Korean (Johab); Johab
1200 1200 Unicode; unicode
1201 Unicode (Big-Endian); unicodeFFFE
65000 Unicode (UTF-7); utf-7
65001 Unicode (UTF-8); utf-8
1258 1258 Vietnamese (Windows); windows-1258
50000 50000 User Defined; x-user-defined
932 50932 Japanese (Auto-Select)
50001 50001 Auto-Select
949 50949 Korean (Auto-Select)

Remarks:

The Session.CodePage property is used to specify CodePage of the body content of pages in a session.

Each output body content should have only one character set, otherwire the displayed characters will be incorrect. For each character set, there is a corresponding code page to represent the character code encoded in the intrinsic objects.

And therefore there is always a code page for every response body output. If Response.CodePage is not explicitly set in a page, the value of CodePage for the page should be determined from other settings.

If sessions are enabled, the Response.CodePage can then be implicitly set by the Session.CodePage.

If sessions are not enabled and the @CodePage is present in the ASP file, the Response.CodePage can then be set by the  @CodePage.

If the @CodePage is not present in the ASP file, the Response.CodePage can then be set by the ASPCodePage metabase property.

If the ASPCodePage metabase property is also not set or is set to 0, the Response.CodePage is then set by the system ANSI code page.

In  IIS 5.0 later, Session.CodePage is no longer implicitly set by @CodePage as before. The change was made because @CodePage and Response.CodePage affect only single responses, and Session.CodePage affects all responses in a session. while @CodePage could change the code page for an entire session in IIS 5.0 and eariler version.

In the case, the code page is set explicitly in two pages or in two different response outputs with one response output is called by the other response output, through #include, Server.Execute, or Server.Transfer, usually the code page of the child response output will be set by the parent response output. However if a Response.CodePage is explicitly set in the parent page of a Server.Execute call, an   @CodePage command in the child page will override the parent code page.

So, the explicit setting of  Response.CodePage or Session.CodePage for nonliteral strings should be set before senting the output to the client.

Besides the encoding of the response output of nonliteral strings in the intrinsic objects, the encoding of the literal strings in a script are still set by the @CodePage if present, the AspCodePage metabase property value if set, or the system ANSI code page with the same priority as for intrinsic objects.

Therefore, when both literal and nonliteral strings are used in the same page, the code page setting by @CodePage should match with the code page setting by Response.CodePage, or the page will display incorrectly because the literal strings are encoded differently from the nonliteral strings in the response output.

Since the system default code page will be used when there is no code page setting in a web page, sometimes it is not necessary to set a code page in the web page for those web client with matched system default code page. However, setting the code page for a web page is alway necessary for encoding the response output correctly for all web client in the WWW.n the WWW.

And therefore if the code page is set in a page, the Response.Charset should also be set in order to ensure the response output is displayed correctly for all web client in the WWW.

In order to make the response output display correctly, the file format of a web page must be stored with the same @CodePage setting used in the page. In window, notepad can save files in UTF-8 format or in the system ANSI format. Therefore the ASP file should be saved in UTF-8 format if the @CodePage is set to 65001. Since notepad can save files in system ANSI format according to the default system locale setting in the Regional and Language Options in the Control Panel, notepad can save file in different file format according to @CodePage setting by changing the system locale setting before saving the file.

Similarly, in order to test web pages that use different code pages and character sets in a client computer, the corresponding language packs should also be installed through the adding of language packs in the Regional and Language Options in the Control Panel.

Examples:

  • Response.CodePage with value "65001" with @CodePage=65001 and Response.CharSet with value "utf-8",  and the ASP file is saved in utf-8 format.

    ASP script command:

    <%= "Session.CodePage: " & Session.CodePage & "<br>" %>
    <%= "Response.CodePage: " & Response.CodePage & "<br>" %>
    <%="Welcome in English<br />"%>
    <%="Bienvenue in French<br />"%>
    <%="Recepción in Spanish<br />"%>
    歡迎 in Traditional Chinese<br />
    欢迎 in Simplified Chinese

    HTTP response output:

    Session.CodePage: 65001<br />
    Response.CodePage: 65001<br />
    Welcome in English<br />
    Bienvenue in French<br />
    Recepción in Spanish<br />
    歡迎 in Traditional Chinese<br />
    欢迎 in Simplified Chinese

    HTML web page ouput:

    Session.CodePage: 65001
    Response.CodePage: 65001
    Welcome in English
    Bienvenue in French
    Recepción in Spanish
    歡迎 in Traditional Chinese
    欢迎 in Simplified Chinese


©sideway

ID: 120200044 Last Updated: 2/12/2012 Revision: 0 Ref:

close

References

  1. Active Server Pages,  , http://msdn.microsoft.com/en-us/library/aa286483.aspx
  2. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
  3. ASP Best Practices,  , http://technet.microsoft.com/en-us/library/cc939157.aspx
  4. ASP Built-in Objects,  , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
  5. Response Object,  , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
  6. Request Object,  , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
  7. Server Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
  8. Application Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
  9. Session Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
  10. ASPError Object,  , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
  11. ObjectContext Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
  12. Debugging Global.asa Files,  , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
  13. How to: Debug Global.asa files,  , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
  14. Calling COM Components from ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
  15. IIS ASP Scripting Reference,  , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
  16. ASP Keywords,  , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
  17. Creating Simple ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
  18. Including Files in ASP Applications,  , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
  19. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
  20. FileSystemObject Object,  , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  , ADO Object Model
  22. ADO Fundamentals,  , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019