File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,7 +66,6 @@ public void WriteRecord(LocalizableString record)
6666 _writer . WriteLine ( $ "msgstr[0] \" \" ") ;
6767 }
6868
69-
7069 _writer . WriteLine ( ) ;
7170 }
7271
@@ -82,7 +81,6 @@ public void WriteRecord(IEnumerable<LocalizableString> records)
8281 }
8382 }
8483
85-
8684 /// <inheritdoc/>
8785 public void Dispose ( )
8886 {
@@ -104,6 +102,7 @@ private static string Escape(string text)
104102 var sb = new StringBuilder ( text ) ;
105103 sb . Replace ( "\\ " , "\\ \\ " ) ; // \ -> \\
106104 sb . Replace ( "\" " , "\\ \" " ) ; // " -> \"
105+ sb . Replace ( "\r \n " , "\\ r\\ n" ) ;
107106 sb . Replace ( "\r " , "\\ r" ) ;
108107 sb . Replace ( "\n " , "\\ n" ) ;
109108
Original file line number Diff line number Diff line change @@ -48,6 +48,27 @@ public void WriteRecord_Escapes()
4848 Assert . Equal ( $ "msgstr \" \" ", result [ 1 ] ) ;
4949 }
5050
51+ [ Fact ]
52+ public void WriteRecord_ShouldEscape_CarriageReturn ( )
53+ {
54+ // Arrange
55+ var localizableString = new LocalizableString
56+ {
57+ Text = "Orchard\r Core"
58+ } ;
59+
60+ // Act
61+ using ( var writer = new PoWriter ( _stream ) )
62+ {
63+ writer . WriteRecord ( localizableString ) ;
64+ }
65+
66+ // Assert
67+ var result = ReadPoStream ( ) ;
68+ Assert . Equal ( "msgid \" Orchard\\ rCore\" " , result [ 0 ] ) ;
69+ Assert . Equal ( "msgstr \" \" " , result [ 1 ] ) ;
70+ }
71+
5172 [ Fact ]
5273 public void WriteRecord_WritesPluralLocalizableString ( )
5374 {
You can’t perform that action at this time.
0 commit comments