0
votes

i have a little problem with my jmeter test plan. i have a jdbc request to extract customers in sql databases from this sql query i retrieve first name and last name only after that i have a beanshell little script to write all my customers in a csv file :

f = new FileOutputStream(vars.get("InputFilePath"));
p = new PrintStream(f);

nb_customer=Integer.parseInt(vars.get("NOM_#"));

for (i=1;i<=nb_customer;i++) {
                p.println(vars.get("NOM_"+i) + ";" + vars.get("PRENOM_"+i));
}

p.close();
f.close();

my problem is that it is an application for our subsidiary company in polska so, all customers first and last name are in polish language with different symbol, characters. in the csv file, they appears with a ? in spite of the real character.

can you help me please ?

thanks a lot

Ludo

1
Maybe the editor you are using to open the file isn't correctly configured ? Why don't you try opening it with notepad++ for example - Boyan Katsarski
Thanks a lot for your answer. I open my csv file with Notepad++. - Ludovic LACHEVRE
no problem, thanks ! - Ludovic LACHEVRE

1 Answers

0
votes
  1. Try explicitly setting encoding to UTF-8, initialize PrintStream as:

    p = new PrintStream(f, true, "UTF-8");
    
  2. Check out JMeter default encoding as:

    log.info(System.getProperty("file.encoding"));
    

    Encoding

    If output is different from UTF-8 add the next line to system.properties file (lives under /bin folder of your JMeter installation:

    file.encoding=UTF-8
    

    and restart JMeter. Alternatively you can pass it via -D command line argument like:

    jmeter -Dfile.encoding=UTF-8
    

    See Apache JMeter Properties Customization Guide for more information on Jmeter properties and ways of setting and overriding them.

  3. Check file contents in JMeter itself by using FileUtils.readFileToString() method like:

    From File