hb_jsondecode() bug on prg encode is 'big5', decode fail!!

127 views
Skip to first unread message

wen....@gmail.com

unread,
Oct 4, 2025, 6:44:48 AM (5 days ago) Oct 4
to harbou...@googlegroups.com
sample prg:

func main()
local hData := {"err_no"=>-1,"errmsg"=>"無法辨識的功能!!","errtil"=>"錯誤!!(3bc8d2ca-a101-4585-afae-a35d483c0796)"}
// local cJson := hb_jsonEncode( hData ) // <--- is ok
local cJson := '{"err_no"=>-1,"errmsg"=>"無法辨識的功能!!","errtil"=>"錯誤!!(3bc8d2ca-a101-4585-afae-a35d483c0796)"}' // is fail!!
local hJson := {=>}, i
? 'json string-1: ',cJson
hJson := hb_jsonDecode( cJson )
aJson := hb_hKeys(hJson)
? 'json len: ', Len(aJson)
FOR i := 1 TO Len(aJson)
? i,':',hb_hKeyAt( hJson, i ), '=>', hb_hValueAt( hJson, i )
NEXT i

//
? 'json string-2: ',cJson
// cJson := hb_StrReplace( cJson, {'\'}, {'\\'} )
hJson := hb_jsonDecode( cJson )
aJson := hb_hKeys(hJson)
? 'json len: ', Len(aJson)
FOR i := 1 TO Len(aJson)
? i,':',hb_hKeyAt( hJson, i ), '=>', hb_hValueAt( hJson, i )
NEXT i
return


test.prg

Nelson Pires

unread,
Oct 7, 2025, 12:01:10 PM (2 days ago) Oct 7
to harbou...@googlegroups.com
Maybe this ?

local cJson := '{"err_no":-1,"errmsg":"無法辨識的功能!!","errtil":"錯誤!!(3bc8d2ca-a101-4585-afae-a35d483c0796)"}'

 

Nelson

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/20251004184440.EE86.CA28FD01%40gmail.com.
Reply all
Reply to author
Forward
0 new messages