Permalink
Browse files

Merge pull request #246 from peterlazzarino/master

Fix for failed tests in pull request #245
  • Loading branch information...
2 parents 9bbcadc + f1398b1 commit eb43d687d861f0413f8879ca342c8b35a761e522 @mythz mythz committed Nov 29, 2012
Showing with 11 additions and 6 deletions.
  1. +7 −2 src/ServiceStack.Text/CsvWriter.cs
  2. +4 −4 src/ServiceStack.Text/TextExtensions.cs
@@ -217,7 +217,12 @@ public static void WriteObject(TextWriter writer, object records)
Write(writer, (IEnumerable<T>)records);
}
- public static void Write(TextWriter writer, IEnumerable<T> records)
+ public static void WriteObjectRow(TextWriter writer, object record)
+ {
+ WriteRow(writer, (T) record);
+ }
+
+ public static void Write(TextWriter writer, IEnumerable<T> records)
{
if (writer == null) return; //AOT
@@ -290,7 +295,7 @@ public static void WriteRow(TextWriter writer, IEnumerable<string> row)
var ranOnce = false;
foreach (var field in row)
{
- JsWriter.WriteItemSeperatorIfRanOnce(writer, ref ranOnce);
+ CsvWriter.WriteItemSeperatorIfRanOnce(writer, ref ranOnce);
writer.Write(field.ToCsvField());
}
@@ -21,13 +21,13 @@ public static class TextExtensions
{
public static string ToCsvField(this string text)
{
- return string.IsNullOrEmpty(text) || !JsWriter.HasAnyEscapeChars(text)
+ return string.IsNullOrEmpty(text) || !CsvWriter.HasAnyEscapeChars(text)
? text
: string.Concat
(
- JsWriter.QuoteString,
- text.Replace(JsWriter.QuoteString, TypeSerializer.DoubleQuoteString),
- JsWriter.QuoteString
+ CsvConfig.ItemDelimiterString,
+ text.Replace(CsvConfig.ItemDelimiterString, CsvConfig.EscapedItemDelimiterString),
+ CsvConfig.ItemDelimiterString
);
}

0 comments on commit eb43d68

Please sign in to comment.