前の日 / 次の日 / 最新 / 2010-09

XINUJP - ChangeWebLog / 2010-09-23

01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

2020 : 01 02 03 04 05 06 07 08 09 10 11 12
2019 : 01 02 03 04 05 06 07 08 09 10 11 12
2018 : 01 02 03 04 05 06 07 08 09 10 11 12
2017 : 01 02 03 04 05 06 07 08 09 10 11 12
2016 : 01 02 03 04 05 06 07 08 09 10 11 12
2015 : 01 02 03 04 05 06 07 08 09 10 11 12
2014 : 01 02 03 04 05 06 07 08 09 10 11 12
2013 : 01 02 03 04 05 06 07 08 09 10 11 12
2012 : 01 02 03 04 05 06 07 08 09 10 11 12
2011 : 01 02 03 04 05 06 07 08 09 10 11 12
2010 : 01 02 03 04 05 06 07 08 09 10 11 12
2009 : 01 02 03 04 05 06 07 08 09 10 11 12
2008 : 01 02 03 04 05 06 07 08 09 10 11 12
2007 : 01 02 03 04 05 06 07 08 09 10 11 12

2010-09-23 Thu

Mantis で日本語 CSV 出力 [mantis]

Mantis の CSVエクスポートは, DB 内のコードをそのまま出力.
なので, UTF-8 で出力されて見事に文字化け.
で, UTF-8 -> SJIS 変換の改造.
ここを参考に.
何とか動いている.

diff -U 3 csv_export.php.orig csv_export.php
--- csv_export.php.orig 2010-09-22 09:41:17.000000000 +0900
+++ csv_export.php 2010-09-23 16:09:47.000000000 +0900
@@ -90,7 +90,7 @@
}
# end of fix

- echo $t_header;
+ echo mb_convert_encoding($t_header,'SJIS', 'UTF-8' );

# export the rows
foreach ( $t_rows as $t_row ) {
@@ -98,7 +98,7 @@
 
  foreach ( $t_columns as $t_column ) {
  if ( !$t_first_column ) {
- echo $t_sep;
+ echo mb_convert_encoding($t_sep,'SJIS', 'UTF-8' );
  } else {
  $t_first_column = false;
  }
@@ -110,12 +110,12 @@
  helper_call_custom_function( $t_column_value_function, array( $t_column, $t_row, COLUMNS_TARGET_CSV_PAGE ) );
  $t_value = ob_get_clean();
 
- echo csv_escape_string($t_value);
+ echo mb_convert_encoding(csv_escape_string($t_value),'SJIS', 'UTF-8' );
  } else {
  $t_function = 'csv_format_' . $t_column;
- echo $t_function( $t_row->$t_column );
+ echo mb_convert_encoding($t_function( $t_row->$t_column ),'SJIS', 'UTF-8' );
  }
  }
 
- echo $t_nl;
+ echo mb_convert_encoding($t_nl,'SJIS', 'UTF-8' );
  }

最終更新時間: 2020-01-25 11:11