Encoding Query result in 'write csv' doesnt work for German Number Formats

Hello all,
I am sending a SQL request and I want to write the results in a csv. But I want the numbers to be in the german standard, as 2,56 instead of 2.56.

I found that I should use “windows-1252” or “ISO 8859-15”, but if I try that i get the error

Write CSV: ‘windows-1252’ is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter ‘name’)

Same goes for a lot of other formats that I thought should be availabe from the link
https://docs.uipath.com/lang-ru/activities/docs/supported-character-encoding

Am I missing something? This seems to be a trivial problem that a lot of other users should have had too …

Hope you can help me, and I hope that I posted this question correctly as is it my first :wink:
Cheers Tim

Hi,

Regarding encoding matter, the following will help you.

as 2,56 instead of 2.56.

However, the above is not encoding matter but cultureinfo matter.

Please use the following expression, for example.

doubleVar.ToString(System.Globalization.CultureInfo.CreateSpecificCulture("DE-de"))

Regards,

Thank you for the quick answer! I forgot to mention that my result is a data table with unknown size, where many numbers and strings appear. Would I then use your code to go through every entry before I write it in the csv?

Hi,

If your data is stored numeric (not string) in the DataTable, it might be better to use the following expression. (Please use Assign activity)

System.Globalization.CultureInfo.CurrentCulture =  New System.Globalization.CultureInfo("DE-de")

Then Write the datatablw to CSV file.

Regards,

1 Like

That worked like a charm,
thank you so much!!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.