By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,843 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,843 IT Pros & Developers. It's quick & easy.

ASPSmartUpload Codepage Property Error

P: 6
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:
Expand|Select|Wrap|Line Numbers
  1. Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
  2. mySmartUpload.CodePage = "UTF-8"
  3. mySmartUpload.Upload
  4.  
I also have the encoding set in the meta tags as mentioned in other ASPSmartUpload FAQ's:
Expand|Select|Wrap|Line Numbers
  1. <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!
Mar 22 '08 #1
Share this Question
Share on Google+
2 Replies


markrawlingson
Expert 100+
P: 346
[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.CodePage affects only the page that is being run whereas Session.CodePage affects all pages within the Session state.[/font]

[font=Arial]
Expand|Select|Wrap|Line Numbers
  1. <%@ CodePage=65001 Language="VBScript"%>
  2. <%
  3. '((65001 indicates UTF-8))
  4. 'You can also use the CharSet method to perform the same action..
  5. Response.CharSet = "utf-8"
  6. %>
  7.  
[/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.CodePage = 65001 in the Session_OnStart sub of your global.asa

Hope this helps.

Sincerely,
Mark
Mar 22 '08 #2

P: 6
These suggestions are very helpful. Thank you!

[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.CodePage affects only the page that is being run whereas Session.CodePage affects all pages within the Session state.[/font]

[font=Arial]
Expand|Select|Wrap|Line Numbers
  1. <%@ CodePage=65001 Language="VBScript"%>
  2. <%
  3. '((65001 indicates UTF-8))
  4. 'You can also use the CharSet method to perform the same action..
  5. Response.CharSet = "utf-8"
  6. %>
  7.  
[/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.CodePage = 65001 in the Session_OnStart sub of your global.asa

Hope this helps.

Sincerely,
Mark
Mar 24 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.