ASPSmartUpload Codepage Property Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MitchellEr
    New Member
    • Mar 2008
    • 6

    ASPSmartUpload Codepage Property Error

    Hi,

    I've seen various forum posts that mention the ability to set ASPSmaryUpload' s Codepage property in order to handle UTF-8 and other character encodings.
    Example: http://www.thescripts.com/forum/thread102044.html

    I'd like to set this property so that foreign characters in form submissions are posted correctly especially for text fields.

    When I try doing it, I receive the following message:
    Microsoft VBScript runtime (0x800A01B6)
    Object doesn't support this property or method: 'CodePage'


    My code is as follows:
    Code:
    Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
    mySmartUpload.CodePage = "UTF-8"
    mySmartUpload.Upload
    I also have the encoding set in the meta tags as mentioned in other ASPSmartUpload FAQ's:
    Code:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    Is there something I need to do to enable this property?
    I'd like to use this object if at all possible since that's what we have currently but if it's not possible to get this working, is there another object someone might suggest I could try?

    Thank you!
  • markrawlingson
    Recognized Expert Contributor
    • Aug 2007
    • 346

    #2
    [font=Arial]As I understand it, CodePage only accepts numerical integers for its values. So try the following directive at the top of your page. 65001 refers to UTF-8. You can also try using the LCID which will change character encoding, financial signs, etc etc. Do some google searches for LCID and CodePage values to see if you can find the integer values that refer to the country you want to set this for. It's also important to note that Response.CodePa ge affects only the page that is being run whereas Session.CodePag e affects all pages within the Session state.[/font]

    [font=Arial][code=asp]
    <%@ CodePage=65001 Language="VBScr ipt"%>
    <%
    '((65001 indicates UTF-8))
    'You can also use the CharSet method to perform the same action..
    Response.CharSe t = "utf-8"
    %>
    [/code][/font]

    [font=Arial]Also, an easier way to add utf-8 encoding to your pages is to add it to the directory in IIS rather than adding it to each file individually. Right click the folder you want to add it to (Usually the root so it has global effectiveness --> properties --> HTTP Headers --> Add --> Custom Header Name = "Content-Type" --> Custom Header Value = "text/html; charset=utf-8" --> ok --> ok[/font]

    You can also set Session.CodePag e = 65001 in the Session_OnStart sub of your global.asa

    Hope this helps.

    Sincerely,
    Mark

    Comment

    • MitchellEr
      New Member
      • Mar 2008
      • 6

      #3
      These suggestions are very helpful. Thank you!

      Originally posted by markrawlingson
      [font=Arial]As I understand it, CodePage only accepts numerical integers for its values. So try the following directive at the top of your page. 65001 refers to UTF-8. You can also try using the LCID which will change character encoding, financial signs, etc etc. Do some google searches for LCID and CodePage values to see if you can find the integer values that refer to the country you want to set this for. It's also important to note that Response.CodePa ge affects only the page that is being run whereas Session.CodePag e affects all pages within the Session state.[/font]

      [font=Arial][code=asp]
      <%@ CodePage=65001 Language="VBScr ipt"%>
      <%
      '((65001 indicates UTF-8))
      'You can also use the CharSet method to perform the same action..
      Response.CharSe t = "utf-8"
      %>
      [/code][/font]

      [font=Arial]Also, an easier way to add utf-8 encoding to your pages is to add it to the directory in IIS rather than adding it to each file individually. Right click the folder you want to add it to (Usually the root so it has global effectiveness --> properties --> HTTP Headers --> Add --> Custom Header Name = "Content-Type" --> Custom Header Value = "text/html; charset=utf-8" --> ok --> ok[/font]

      You can also set Session.CodePag e = 65001 in the Session_OnStart sub of your global.asa

      Hope this helps.

      Sincerely,
      Mark

      Comment

      Working...