diff options
author | Dirk Jagdmann <doj@cubic.org> | 2016-09-23 01:46:16 -0700 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-09-29 01:20:05 +0000 |
commit | 14be63a807a850221a83914d135329dee19bc18b (patch) | |
tree | 348fda5b2d902b5292be5ba385ec009c6d4a71bb /epan/print.c | |
parent | 7aa243c0c76a0d27e6cf1bb97f2568009a093039 (diff) |
set PDML and PSML encoding to UTF-8. replace fputs() with fprintf() in writing PSML and PDML preambles for more consistent code formatting.
Change-Id: I57dbb27cbf935dd31342639b315d1fc98bd27d77
Reviewed-on: https://code.wireshark.org/review/17895
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/print.c')
-rw-r--r-- | epan/print.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/epan/print.c b/epan/print.c index bf477544b0..3ae96f5a0c 100644 --- a/epan/print.c +++ b/epan/print.c @@ -250,11 +250,15 @@ write_pdml_preamble(FILE *fh, const gchar *filename) ts[strlen(ts)-1] = 0; /* overwrite \n */ - fputs("<?xml version=\"1.0\"?>\n", fh); - fputs("<?xml-stylesheet type=\"text/xsl\" href=\"" PDML2HTML_XSL "\"?>\n", fh); + fprintf(fh, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); + fprintf(fh, "<?xml-stylesheet type=\"text/xsl\" href=\"" PDML2HTML_XSL "\"?>\n"); fprintf(fh, "<!-- You can find " PDML2HTML_XSL " in %s or at https://code.wireshark.org/review/gitweb?p=wireshark.git;a=blob_plain;f=" PDML2HTML_XSL ". -->\n", get_datafile_dir()); - fputs("<pdml version=\"" PDML_VERSION "\" ", fh); - fprintf(fh, "creator=\"%s/%s\" time=\"%s\" capture_file=\"%s\">\n", PACKAGE, VERSION, ts, filename ? filename : ""); + fprintf(fh, "<pdml version=\"" PDML_VERSION "\" creator=\"%s/%s\" time=\"%s\" capture_file=\"", PACKAGE, VERSION, ts); + if (filename) { + /* \todo filename should be converted to UTF-8. */ + print_escaped_xml(fh, filename); + } + fprintf(fh, "\">\n"); } void @@ -1175,9 +1179,8 @@ write_psml_preamble(column_info *cinfo, FILE *fh) { gint i; - fputs("<?xml version=\"1.0\"?>\n", fh); - fputs("<psml version=\"" PSML_VERSION "\" ", fh); - fprintf(fh, "creator=\"%s/%s\">\n", PACKAGE, VERSION); + fprintf(fh, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); + fprintf(fh, "<psml version=\"" PSML_VERSION "\" creator=\"%s/%s\">\n", PACKAGE, VERSION); fprintf(fh, "<structure>\n"); for (i = 0; i < cinfo->num_cols; i++) { |