VMware Cloud Community
FTVDaniel
Contributor
Contributor

import file in vro with utf8 encoding

Hello, I use the scripting class

new MimeAttachment(csvfilepath);

to import in VRO a CSV file,

the issue is that there are special caracters in the CSV file. How can I import the file in utf8 encoding? for vro to be able to understand special caracters?

is that possible?

thanks

0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee

Internally, MimeAttachment scripting class uses some string methods that rely on platform's default charset. In latest vRO server versions this charset is set to UTF-8 (check file.encoding property in file /var/lib/vco/app-server/bin/setenv.sh).

Which vRO version do you use? Could you show some special characters that you think are not handled correctly by MimeAttachment? Also, could you show the scripting code you think is not working with these special characters?

0 Kudos
FTVDaniel
Contributor
Contributor

hello,

I am using version 7.3

and the property file.encoding si set to utf8

# Set default file encoding

JVM_OPTS="$JVM_OPTS -Dfile.encoding=UTF-8"

french accents are not recognised

préproduction  becomes  Pr�production

0 Kudos
iiliev
VMware Employee
VMware Employee

Tried it in my 7.3 environment; works as expected. What I tried is to output the text in the logs using System.log(), and also to output it to a file using FileWriter. In both cases, french accents were there.

Could you provide a sample workflow or scripting code showing how do you test it? Also, make sure that it is not a visual-only problem (not all editors out there can show proper Unicode characters).

0 Kudos
FTVDaniel
Contributor
Contributor

according to what you said I tried to figure out where in the files flow my file loosed the encoding and I think I found it

I first create this csv file in an office document. at this point the accent is recognised

I then transfert it to vco for me to be able to work with it

I use  the code to import file from vm guest to vco

var fileManager = guestOperationsManager.fileManager;

var ftInfo = fileManager.initiateFileTransferFromGuest(vm , guestAuth ,sourceCsvFilePath);

result = fileManager.downloadFile(vcoCsvFilePath, ftInfo);

and it is this code that breaks the encoding I presume because if I read the file directly in vro the acccent caracter is replaced

so nothing related to the csv read

0 Kudos