Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions json.prg
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
* vfpjson
*
* ----------------------------------
* Ignacio Guti�rrez Torrero
* Ignacio Gutiérrez Torrero
* SAIT Software Administrativo
* www.sait.com.mx
* +52(653)534-8800
* Monterrey M�xico
* Monterrey México
* -----------------------------------
*
* JSON Library in VFP
Expand Down Expand Up @@ -67,6 +67,7 @@ function json_encode(xExpr)
public _json
_json = newobject('json')
endif
_json.setError("")
return _json.encode(@xExpr)


Expand Down Expand Up @@ -514,26 +515,26 @@ define class json as custom
return substr(this.cJson, this.nPos, 1)

function setError(cMsg)
this.cError= 'ERROR parsing JSON at Position:'+allt(str(this.nPos,6,0))+' '+cMsg
this.cError= IIF(EMPTY(cMsg), '', 'ERROR parsing JSON at Position:'+allt(str(this.nPos,6,0))+' '+cMsg)
return

function getError()
return this.cError


function fixUnicode(cStr)
cStr = StrTran(cStr,'\u00e1','')
cStr = StrTran(cStr,'\u00e9','')
cStr = StrTran(cStr,'\u00ed','')
cStr = StrTran(cStr,'\u00f3','')
cStr = StrTran(cStr,'\u00fa','')
cStr = StrTran(cStr,'\u00c1','')
cStr = StrTran(cStr,'\u00c9','')
cStr = StrTran(cStr,'\u00cd','')
cStr = StrTran(cStr,'\u00d3','')
cStr = StrTran(cStr,'\u00da','')
cStr = StrTran(cStr,'\u00f1','')
cStr = StrTran(cStr,'\u00d1','')
cStr = StrTran(cStr,'\u00e1','á')
cStr = StrTran(cStr,'\u00e9','é')
cStr = StrTran(cStr,'\u00ed','í')
cStr = StrTran(cStr,'\u00f3','ó')
cStr = StrTran(cStr,'\u00fa','ú')
cStr = StrTran(cStr,'\u00c1','Á')
cStr = StrTran(cStr,'\u00c9','É')
cStr = StrTran(cStr,'\u00cd','Í')
cStr = StrTran(cStr,'\u00d3','Ó')
cStr = StrTran(cStr,'\u00da','Ú')
cStr = StrTran(cStr,'\u00f1','ñ')
cStr = StrTran(cStr,'\u00d1','Ñ')
return cStr


Expand Down