Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 10th, 2008, 11:10 AM
Registered User
Join Date: May 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CSV files export with Classic ASP, special chars

 HI All

I'm exporting data from Oracle DB to CSV files using Classic ASP. All is good here except some issues with special chars. The Special chars get garbled when the file size is increasing.

Look at my code..

The lines in the code are the options I tried.

Here is the code

' Create the CSV file
Response.ContentType = "text/plain;charset=utf-8;"
'Response.AddHeader "Content-Type", "text/csv;charset=UTF-8"
Response.AddHeader "Content-Disposition", "attachment;filename=Data.csv"
'Response.CharSet = "utf-8"

' Writing data
Response.write data

The special chars in this row is part of the CSV file

"testing special chars dès 196 vol+ hôtel"

is completely getting junk when the file size is big (may be 1000 records). But when the file size is small (may be 20 records) it is perfectly good.

BAsed on some parameters (user selection) in the webpage & clicking on the submit button, I'm calling an ASP file that creates the CSV file.

Plz help me. I badly need this..

Old July 9th, 2015, 08:12 AM
Registered User
Join Date: Jul 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default ut8 issue on classic asp export csv

Further to my comments if you are opening your CSV in Excel and wondering why the UTF-8 encoding isn't working, don't worry this is a side effect of how Excel identifies UTF-8 CSV data.

Try adding this before writing your output

'BOM to dup Excel into encoding the CSV correctly instead of using ASCII!!!
Call Response.BinaryWrite(ChrB(239) & ChrB(187) & ChrB(191))

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I upload files in classic ASP? murshed Classic ASP Databases 8 August 4th, 2008 05:26 PM
How to get the special chars(%#&'') from JSP to Ja kasipandian Javascript 1 February 3rd, 2008 11:48 AM
Csv Export Coby Access VBA 4 July 25th, 2007 08:19 AM
Classic ASP - how to export data from modal window calgarychinese Classic ASP Basics 1 November 14th, 2006 09:11 AM
Export data in to csv file from asp.netpage madhusrp ASP.NET 1.0 and 1.1 Professional 1 June 9th, 2006 09:15 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.