preliminary CR/LF handling, pending port of autodetect

This commit is contained in:
John Kerl 2021-03-26 15:04:33 +00:00
parent c59913f9fd
commit dee599ec5b
4 changed files with 17 additions and 0 deletions

View file

@ -146,6 +146,9 @@ func (this *RecordReaderCSVLite) processHandleExplicitCSVHeader(
// This is how to do a chomp:
line = strings.TrimRight(line, this.irs)
// xxx temp pending autodetect, and pending more windows-port work
line = strings.TrimRight(line, "\r\n")
if line == "" {
// Reset to new schema
headerStrings = nil
@ -237,6 +240,9 @@ func (this *RecordReaderCSVLite) processHandleImplicitCSVHeader(
// This is how to do a chomp:
line = strings.TrimRight(line, this.irs)
// xxx temp pending autodetect, and pending more windows-port work
line = strings.TrimRight(line, "\r\n")
if line == "" {
// Reset to new schema
headerStrings = nil

View file

@ -71,6 +71,10 @@ func (this *RecordReaderDKVP) processHandle(
} else {
// This is how to do a chomp:
line = strings.TrimRight(line, "\n")
// xxx temp pending autodetect, and pending more windows-port work
line = strings.TrimRight(line, "\r\n")
record := recordFromDKVPLine(&line, &this.ifs, &this.ips)
context.UpdateForInputRecord()
inputChannel <- types.NewRecordAndContext(

View file

@ -72,6 +72,10 @@ func (this *RecordReaderNIDX) processHandle(
} else {
// This is how to do a chomp:
line = strings.TrimRight(line, "\n")
// xxx temp pending autodetect, and pending more windows-port work
line = strings.TrimRight(line, "\r\n")
record := recordFromNIDXLine(&line, &this.ifs)
context.UpdateForInputRecord()

View file

@ -101,6 +101,9 @@ func (this *RecordReaderXTAB) processHandle(
// This is how to do a chomp:
line = strings.TrimRight(line, this.irs)
// xxx temp pending autodetect, and pending more windows-port work
line = strings.TrimRight(line, "\r\n")
if line == "" {
if linesForRecord.Len() > 0 {
record, err := this.recordFromXTABLines(linesForRecord)