[Powertop] [PATCH] fix-csv: cell alignment with regional formats

Alexandra Yates <alexandra.yates at linux.intel.com>
Newsgroups dev.linux.lists.powertop
Message-ID <1402703457-30614-2-git-send-email-alexandra.yates@linux.intel.com>
In most languages a decimal number is expressed with a coma rather than a
dot.  This confuses the csv parsing creating new columns.
This patch separates the value with a semicolon to avoid the issue.

Signed-off-by: Alexandra Yates <alexandra.yates(a)linux.intel.com>
---
 src/report/report-formatter-csv.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/report/report-formatter-csv.cpp b/src/report/report-formatter-csv.cpp
index f7fb313..523e79b 100644
--- a/src/report/report-formatter-csv.cpp
+++ b/src/report/report-formatter-csv.cpp
@@ -132,7 +132,7 @@ report_formatter_csv::add_summary_list(string *list, int size)
 	for (i=0; i < size; i+=2){
 		addf_exact("%s %s", list[i].c_str(), list[i+1].c_str());
 		if(i < (size - 1))
-			add_exact(",");
+			add_exact(";");
 	}
 	add_exact("\n");
 }
@@ -155,7 +155,7 @@ report_formatter_csv::add_table(string *system_data, struct table_attributes* tb
 			else{
 				addf_exact("%s", system_data[offset].c_str());
 				if(j < (tb_attr->cols - 1))
-					add_exact(",");
+					add_exact(";");
 			}
 		}
 		if(empty_row < tb_attr->cols)
-- 
1.7.9.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.