diff --git a/Version Control.accda.src/modules/clsOptions.bas b/Version Control.accda.src/modules/clsOptions.bas index cff12759..d1eb0b1d 100644 --- a/Version Control.accda.src/modules/clsOptions.bas +++ b/Version Control.accda.src/modules/clsOptions.bas @@ -321,4 +321,7 @@ Private Sub Class_Initialize() ' Load default values Me.LoadDefaults + ' Other run-time options + JsonOptions.AllowUnicodeChars = True + End Sub \ No newline at end of file diff --git a/Version Control.accda.src/modules/modJsonConverter.bas b/Version Control.accda.src/modules/modJsonConverter.bas index 8e160712..7c4f3159 100644 --- a/Version Control.accda.src/modules/modJsonConverter.bas +++ b/Version Control.accda.src/modules/modJsonConverter.bas @@ -153,6 +153,9 @@ Private Type json_Options ' The solidus (/) is not required to be escaped, use this option to escape them as \/ in ConvertToJson EscapeSolidus As Boolean + + ' Allow Unicode characters in JSON text. Set to True to use native Unicode or false for escaped values. + AllowUnicodeChars As Boolean End Type Public JsonOptions As json_Options @@ -724,9 +727,14 @@ Private Function json_Encode(ByVal json_Text As Variant) As String Case 9 ' tab -> 9 -> \t json_Char = "\t" - Case 0 To 31, 127 To 65535 + Case 0 To 31 ' Non-ascii characters -> convert to 4-digit hex json_Char = "\u" & VBA.Right$("0000" & VBA.Hex$(json_AscCode), 4) + Case 127 To 65535 + ' Unicode character range + If Not JsonOptions.AllowUnicodeChars Then + json_Char = "\u" & VBA.Right$("0000" & VBA.Hex$(json_AscCode), 4) + End If End Select json_BufferAppend json_Buffer, json_Char, json_BufferPosition, json_BufferLength