Skip to content

Commit 0a9c1d4

Browse files
authored
Merge pull request #531 from marek22k/xmlencoding
Set UTF-8 encoding for XML reports
2 parents 3aa50b7 + 673de6f commit 0a9c1d4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ui/mtr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include <assert.h>
4545
#include <fcntl.h>
4646
#include <limits.h>
47+
#include <locale.h>
4748
#include <sys/stat.h>
4849
#include <sys/time.h>
4950

@@ -776,6 +777,9 @@ int main(
776777
/* This will check if stdout/stderr writing is successful */
777778
atexit(close_stdout);
778779

780+
/* Set encoding for reports */
781+
setlocale(LC_CTYPE, "C.UTF-8");
782+
779783
/* reset the random seed */
780784
init_rand();
781785

ui/report.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ void xml_close(
408408
char name[MAX_FORMAT_STR];
409409
char buf[128];
410410

411-
printf("<?xml version=\"1.0\"?>\n");
411+
printf("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n");
412412
printf("<MTR SRC=\"%s\" DST=\"%s\"", ctl->LocalHostname,
413413
ctl->Hostname);
414414
printf(" TOS=\"0x%X\"", ctl->tos);

0 commit comments

Comments
 (0)