Skip to contentSkip to conversation

fix-csv: cell alignment with regional formats

PATCH New Alexandra Yates 2 participants 3 messages Jun 13, 2014 – Jun 16, 2014

lore
Share & tools
lore

Alexandra Yates

author
#0 lore raw

PATCH 1/1 fix-csv: cell alignment with regional formats

This patch fixes translation cvs errors and coma parsing error.

Alexandra Yates (1):
fix-csv: cell alignment with regional formats

 src/report/report-formatter-csv.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/1 fix-csv: cell alignment with regional formats

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(-)
src/report/report-formatter-csv.cpp +2 -2
index f7fb313..523e79b 100644
@@ -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)
Signature · 1 line
1.7.9.5
#2 lore raw

Tested with regional formats "English" and "Français", I confirm it fixes the problem.

PowerTOP versionv2.6.1
commit dfc2ba97ffba44b51379fd3617a4f6fead40037d

-----Original Message-----
From: PowerTop [mailto:powertop-bounces(a)lists.01.org] On Behalf Of Alexandra Yates
Sent: Saturday, June 14, 2014 1:51 AM
To: powertop(a)lists.01.org
Subject: [Powertop] [PATCH] fix-csv: cell alignment with regional formats

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(-)
src/report/report-formatter-csv.cpp +2 -2
index f7fb313..523e79b 100644
@@ -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

_______________________________________________
PowerTop mailing list
PowerTop(a)lists.01.org
https://lists.01.org/mailman/listinfo/powertop
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris, 92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.