Skip to content

Commit

Permalink
Update new line handling
Browse files Browse the repository at this point in the history
Addresses VBA-tools#41.

Fix as per discussion in VBA-tools/VBA-Web#270
  • Loading branch information
Sophist-UK committed Jan 9, 2017
1 parent b6108e8 commit c25b458
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions JsonConverter.bas
Original file line number Diff line number Diff line change
Expand Up @@ -557,11 +557,21 @@ Private Function json_ParseString(json_String As String, ByRef json_Index As Lon
json_BufferAppend json_buffer, vbFormFeed, json_BufferPosition, json_BufferLength
json_Index = json_Index + 1
Case "n"
json_BufferAppend json_buffer, vbCrLf, json_BufferPosition, json_BufferLength
json_Index = json_Index + 1
If VBA.Mid$(json_String, json_Index+1, 2) == "\r" Then
json_BufferAppend json_buffer, vbCrLf, json_BufferPosition, json_BufferLength
json_Index = json_Index + 3
Else
json_BufferAppend json_buffer, vbLf, json_BufferPosition, json_BufferLength
json_Index = json_Index + 1
End If
Case "r"
json_BufferAppend json_buffer, vbCr, json_BufferPosition, json_BufferLength
json_Index = json_Index + 1
If VBA.Mid$(json_String, json_Index+1, 2) == "\n" Then
json_BufferAppend json_buffer, vbCrLf, json_BufferPosition, json_BufferLength
json_Index = json_Index + 3
Else
json_BufferAppend json_buffer, vbCr, json_BufferPosition, json_BufferLength
json_Index = json_Index + 1
End If
Case "t"
json_BufferAppend json_buffer, vbTab, json_BufferPosition, json_BufferLength
json_Index = json_Index + 1
Expand Down

0 comments on commit c25b458

Please sign in to comment.