Skip to content

Invalid UTF-8 characters in result files #110

Description

@Luthaf

Running the example simulation with mpiexec -n 2 Excimontec.exe parameters_default.txt results in results0.txt looking like this:

Excimontec v1.0.0-rc.4 Results:
Calculation time elapsed is 0.0166667 minutes.
8.98174e-05 seconds have been simulated.
44426 events have been executed.

Exciton diffusion test results:
100 excitons have been created.
Exciton diffusion length is 23.3244 � 15.0653 nm.
Exciton hop distance is 1.60557 � 1.52862 nm.
Exciton lifetime is 5.35038e-10 � 4.51257e-10 s.

There are three invalid UTF-8 values, as confirmed by iconv -f UTF-8 results0.txt > /dev/null; echo $? returning iconv: results0.txt:8:36: cannot convert. These seems to be set in

Excimontec/src/main.cpp

Lines 290 to 292 in df5a37f

resultsfile << "Exciton diffusion length is " << vector_avg(sim.getExcitonDiffusionData()) << " ± " << vector_stdev(sim.getExcitonDiffusionData()) << " nm.\n";
resultsfile << "Exciton hop distance is " << vector_avg(sim.getExcitonHopLengthData()) << " ± " << vector_stdev(sim.getExcitonHopLengthData()) << " nm.\n";
resultsfile << "Exciton lifetime is " << vector_avg(sim.getExcitonLifetimeData()) << " ± " << vector_stdev(sim.getExcitonLifetimeData()) << " s.\n";
.

The file looks fine using CP-1252 encoding, so I guess that would be the one you used. Most Unix OS do not use this encoding by default, so Linux users will not see these characters.

On the other hand, nowadays UTF-8 is pretty well supported on Windows, so changing everything to UTF-8 should be fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions