Date: Fri, 24 Jul 2009 12:13:37 GMT From: Takanori Watanabe <takawata@init-main.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/137051: libOFX does not handle encoding properly Message-ID: <200907241213.n6OCDbn5028053@www.freebsd.org> Resent-Message-ID: <200907241220.n6OCK18H020479@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 137051 >Category: ports >Synopsis: libOFX does not handle encoding properly >Confidential: no >Severity: critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 24 12:20:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Takanori Watanabe >Release: 8.0-CURRENT >Organization: >Environment: FreeBSD konata.init-main.com 8.0-CURRENT FreeBSD 8.0-CURRENT #9 r194239M: Tue Jun 16 00:55:05 JST 2009 takawata@rin.init-main.com:/usr/obj/usr/src.svn/head/sys/LIEUTENANT i386 >Description: libOFX does not handle OFX headers properly because each header contains LF (and possibly CR) and does not take care when handle that header. So the encoding header is not handled properly. >How-To-Repeat: Use libofx related tools (gnucash import, ofxdump ....etc. ) to import OFX file with UTF-8 encoding. >Fix: add file attached as files/patch-utf8_fix and recompile it. Patch attached with submission follows: --- lib/ofx_preproc.cpp.orig 2009-07-24 18:48:05.000000000 +0900 +++ lib/ofx_preproc.cpp 2009-07-24 20:34:52.000000000 +0900 @@ -151,7 +151,7 @@ fromcode=LIBOFX_DEFAULT_INPUT_ENCODING; } } - else if(ofx_encoding.compare("USASCII")==0) { + else if(ofx_encoding.compare("UTF-8")==0) { fromcode="UTF-8"; } else @@ -170,6 +170,16 @@ header_name.assign(s_buffer.substr(0,header_separator_idx)); header_value.assign(s_buffer.substr(header_separator_idx+1)); message_out(DEBUG,"ofx_proc_file():Header: "+header_name+" with value: "+header_value+" has been found"); + + if((header_separator_idx = header_value.find('\r', 0)) + != std::string::npos) + header_value.resize(header_separator_idx); + + if((header_separator_idx = header_value.find('\n', 0)) + != std::string::npos) + header_value.resize(header_separator_idx); + + if(header_name.compare("ENCODING")==0) { ofx_encoding.assign(header_value); } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200907241213.n6OCDbn5028053>