Skip to content

Commit

Permalink
new boolean property ParseUTF8 in JsonToCursor() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Irwin1985 committed Oct 7, 2023
1 parent d64792f commit e24cc83
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
Binary file modified JSONFox.PJT
Binary file not shown.
Binary file modified JSONFox.pjx
Binary file not shown.
Binary file modified jsonfox.app
Binary file not shown.
20 changes: 18 additions & 2 deletions src/cursortoarray.prg
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,27 @@
define class CursorToArray as session
nSessionID = 0
CurName = ""
&& IRODG 07/10/2023 Inicio
ParseUTF8 = .f.
&& IRODG 07/10/2023 Fin
* Function CursorToArray
function CursorToArray as memo
if !empty(this.nSessionID)
set datasession to this.nSessionID
endif
private JSONUtils
JSONUtils = _screen.JSONUtils
local lcOutput as memo, i as Integer
local lcOutput as memo, ;
i as Integer, ;
lcValue as Variant, ;
llCentury as Boolean, ;
llDeleted as Boolean, ;
lcDateAct as string, ;
nCounter as Integer, ;
lnTotField as Integer, ;
lnTotal as Integer, ;
lnRecNo as Integer

lcOutput = "["
llCentury = set("Century") == "OFF"
llDeleted = set("Deleted") == "OFF"
Expand Down Expand Up @@ -57,7 +70,10 @@ define class CursorToArray as session
Otherwise
&& IRODG 08/08/2023 Inicio
*lcValue = JSONUtils.GetString(alltrim(lcValue))
lcValue = JSONUtils.GetString(lcValue)
&& IRODG 07/10/2023 Inicio
*!* lcValue = JSONUtils.GetString(lcValue)
lcValue = JSONUtils.GetString(lcValue, this.ParseUTF8)
&& IRODG 07/10/2023 Fin
&& IRODG 08/08/2023 Fin
endcase
&& IRODG 08/08/2023 Inicio
Expand Down
7 changes: 5 additions & 2 deletions src/jsonclass.prg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define class JSONClass as session
LastErrorText = ""
lError = .f.
lShowErrors = .t.
version = "9.16"
version = "9.17"
hidden lInternal
hidden lTablePrompt
Dimension aCustomArray[1]
Expand Down Expand Up @@ -244,7 +244,7 @@ define class JSONClass as session
endfunc
* CursorToJSON
function CursorToJSON as memo
lparameters tcCursor as string, tbCurrentRow as Boolean, tnDataSession as integer, tlJustArray as Boolean
lparameters tcCursor as string, tbCurrentRow as Boolean, tnDataSession as integer, tlJustArray as Boolean, tlParseUTF8 as Boolean
local lcJsonXML as memo, loParser, lcCursor
lcJsonXML = ''
lcCursor = SYS(2015)
Expand All @@ -262,6 +262,9 @@ define class JSONClass as session
loParser = createobject("CursorToArray")
loParser.CurName = lcCursor
loParser.nSessionID = tnDataSession
&& IRODG 07/10/2023 Inicio
loParser.ParseUTF8 = tlParseUTF8
&& IRODG 07/10/2023 Fin
lcJsonXML = loParser.CursorToArray()
catch to loEx
this.ShowExceptionError(loEx)
Expand Down

0 comments on commit e24cc83

Please sign in to comment.