Hi,

I have a ListView which represents a shopping list and contains a number of items. I also have an <Export> button which, when clicked, writes all the items in the listview to a CSV file.

My problem is that when I test this on a Spanish Win2000 PC the displayed text in the list is output incorrectly.

e.g.
"Protección de carcasa"

is output as

"Protección de carcasa"



Does anybody have any suggestions?


VB Code:
  1. Private Sub cmdExport_Click(ByVal sender As System.Object, _
  2.                                 ByVal e As System.EventArgs) _
  3.                                                     Handles cmdExport.Click
  4.         'Export the Shopping List in CSV format.
  5.         Dim str As String
  6.         Dim int As Integer
  7.  
  8.  
  9.         If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
  10.             Dim strFile As String = SaveFileDialog1.FileName
  11.             If strFile <> "" Then
  12.                 Dim swExport As StreamWriter
  13.                 Try
  14.                     Dim utf8 As New System.Text.UTF8Encoding()
  15.                     swExport = New StreamWriter(New FileStream(strFile, _
  16.                                                 FileMode.OpenOrCreate), utf8)
  17.                     '"ProductCode,Description,LoopA,LoopB,LoopC,LoopD,Total"
  18.                     swExport.WriteLine(GetText("exportFileHeader"))
  19.  
  20.                     Dim ShoppingListItem As ListViewItem
  21.                     For Each ShoppingListItem In lvwShoppingList.Items
  22.                         str = ""
  23.                         For int = 0 To 6
  24.                             str &= ShoppingListItem.SubItems(int).Text & ","
  25.                         Next int
  26.                         'Remove the trailing "," from the string.
  27.                         str = Mid(str, 1, str.Length - 1)
  28.                         swExport.WriteLine(str)
  29.                     Next ShoppingListItem
  30.  
  31.                 Finally
  32.                     swExport.Close()
  33.                 End Try
  34.             End If
  35.         End If
  36.     End Sub