title: How to set encoding of a variable when passing between ASP pages
body: <p>Let's say I have page A, which uses ks_c_5601-1987(Korean) as encoding and page B, using UTF-8 (Korean) as encoding. I need to pass a string variable from A to B that is in Korean. Because two pages use a different encoding, the variable gets jumbled up when B receives it using Request().</p>
  
  <p>How can I encode the string variable in A to UTF-8 when passing it to B? I'm aware that setting both pages as UTF-8 encoding scheme is the most sensible solution here but it unfortunately is not an option here since page A uses several dlls that relies entirely on ks_c_5601-1987 encoding. </p>
  
  <p>Edit: After reviewing the answer, I have went ahead and tried the method. This is the code to send the variable mailbox into get_list_center.asp:</p>
  
  <pre><code>&lt;!--mail_mail.asp, page in ks_c_5601-1987--&gt;
  &lt;%
  dim mailbox = "테스트"
  Response.CodePage = 65001 'Response.write should now encode the string into UTF-8
  %&gt;
  
  ...
  &lt;frame name="get_list_center" scrolling="auto" marginwidth="0" framespacing="0" marginheight="0" frameborder="0" src="get_list_center.asp?mailbox=&lt;%=mailbox%&gt;"&gt;
  </code></pre>
  
  <p>and this is how I'm receiving the variable in get_list_center.asp:</p>
  
  <pre><code>&lt;%
  Session.Codepage=65001
  
  Response.CharSet="UTF-8" 
  
  response.Write CStr(response.codepage) &amp; "&lt;BR&gt;"
  response.Write CStr(session.CodePage) &amp; "&lt;BR&gt;"
  response.Write CStr(response.CharSet) &amp; "&lt;BR&gt;"
  response.codepage = 949
  response.Write mailbox &amp; "&lt;BR&gt;"
  response.codepage = 65001
  response.Write mailbox &amp; "&lt;BR&gt;"
  %&gt;
  </code></pre>
  
  <p>Here is the result:</p>
  
  <p><img src="https://i.stack.imgur.com/PKYdl.jpg" alt="enter image description here"></p>
  
  <p>Both 949 (ks_c_5601-1987) and 65001 (UTF-8) versions of response.write comes out broken. Is there anything else I'm missing?</p>