Click here to Skip to main content
15,894,907 members

Export To CSV file It displays Spanish Character

rajrprk asked:

Open original thread
The Below Code i have used to Export for CSV Format
VB
<  Dim FileFullPath As String = System.IO.Path.GetFullPath(psPhysicalFileName)
        Dim FileExtension As String = System.IO.Path.GetExtension(FileFullPath)

        ' Determine the original file name.
        ' When the download window opens, show the original file name in the File Name textbox.
        Dim OriginalFileName As String = System.IO.Path.GetFileName(psOriginalFileName)

        Dim FileType As String = String.Empty
        Dim FileContentType As String = String.Empty

        Try
            If Not IsDBNull(FileExtension) Then
                FileType = LCase(FileExtension)

                ' Determine the content type based on the file extension.
                Select Case FileType
                    Case ".html"
                        FileContentType = "text/HTML"
                    Case ".gif"
                        FileContentType = "image/GIF"
                    Case "jpeg"
                        FileContentType = "image/JPEG"
                    Case ".txt"
                        FileContentType = "text/plain"
                    Case ".csv"
                        FileContentType = "text/csv"
                End Select
            End If

            ' The dialog should show the original file name.
            If (forceDownload) Then
                Response.AppendHeader("content-disposition", _
                                      "attachment; filename=" & OriginalFileName)
            End If

            ' Sent the content type so that browser will know how to handle the file.
            If FileType <> String.Empty Then
                Response.ContentType = FileContentType
            End If


            ' Initiate the download
            Response.WriteFile(FileFullPath.ToString())

            ' Show the link to all the user to download the file if necessary.
            If Not LabelMessage Is Nothing Then
                lblMessage.Text = "You have downloaded the file " & OriginalFileName

            End If

            Response.End()

        Catch oEx As Exception

            ' Show the error message if needed.
            If Not LabelMessage Is Nothing Then
                lblMessage.Text = "Error downloading the file " & OriginalFileName
            End If

        Finally
            ' Clean up objects
        End Try
>


In one cell,i get output like
"Left Message – VM" Instead of "Left Message - VM"
Thanks in Advance
Tags: C#, Visual Basic

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900