Skip to content

new line issue #291

Description

@kausarkhanlp504-2

on line 578.
you are converting -> \n to vbcrlf, which charactor code is 13 -> carriage return key. not \n key
the correct constant for -> \n is -> vblf

vbcr = vbcrlf = vbnewline -> charcode is 13, but vblf charcode is 10

old:

Private Function json_ParseString(json_String As String, ByRef json_Index As Long, ByRef json_Length As Long) As String
    Do While json_Index > 0 And json_Index <= json_Length
        json_Char = VBA.Mid$(json_String, json_Index, 1)

        Select Case json_Char
        Case "\"
            ' Escaped string, \\, or \/
            json_Index = json_Index + 1
            json_Char = VBA.Mid$(json_String, json_Index, 1)

            Select Case json_Char
            Case """", "\", "/", "'"
            Case "b"
            Case "f"
            Case "n"
                json_BufferAppend json_Buffer, vbCrLf, json_BufferPosition, json_BufferLength
                json_Index = json_Index + 1
            Case "r"
            Case "t"
            Case "u"
            End Select
        Case json_Quote
        Case Else
        End Select
    Loop
End Function

new:

```vba
Private Function json_ParseString(json_String As String, ByRef json_Index As Long, ByRef json_Length As Long) As String
    Do While json_Index > 0 And json_Index <= json_Length
        json_Char = VBA.Mid$(json_String, json_Index, 1)

        Select Case json_Char
        Case "\"
            ' Escaped string, \\, or \/
            json_Index = json_Index + 1
            json_Char = VBA.Mid$(json_String, json_Index, 1)

            Select Case json_Char
            Case """", "\", "/", "'"
            Case "b"
            Case "f"
            Case "n"
                json_BufferAppend json_Buffer, vbLf, json_BufferPosition, json_BufferLength
                json_Index = json_Index + 1
            Case "r"
            Case "t"
            Case "u"
            End Select
        Case json_Quote
        Case Else
        End Select
    Loop
End Function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions