ASP » Session » CodePage

The CodePage property specifies the server codepage that will be used to display dynamic content.

The CodePage property specifies which server codepage to use when displaying dynamic Active Server Pages. A codepage is a character set used for symbol mapping. The default value of the CodePage varies by location and language. If you specify a new CodePage property, it will exist only for the duration of the session.


<% @CodePage = 437
//Save orginal codepage information
Session("CodePage") = Session.CodePage
//ID is the CodePage ID from form and
//text is the text entered in the Form
ID = Request.Form("ID")
text = Request.Form("ToTranslate")
//Look up text in specified language. The function FindTranslation
//does the work of finding the translation.
Session.CodePage = ID
translation = FindTranslation(text, ID)
//Change CodePage in order to write in English then change
//it again to write in specified language
If translation <> "" Then
   Session.CodePage = Session("CodePage")
   Response.Write "The translation of " & text & " is "
   Session.CodePage = ID
   Response.Write translation
End If