Homerclese Member Licensed User Longtime User Jun 16, 2016 #1 My web services return utf-8 formatted text data (the response header contains Content-Type: application/json; charset=utf-8) and I have an iOS app that successfully consumes these web services. However using HTTPJob.GetString on the same web services results in a string that gets truncated at the same point every time and I'm wondering if there might be a character causing an issue. I've searched this forum and it seems I'm not the only one to experience this problem but it's not clear to me what the solution is when the character set is already utf-8.
My web services return utf-8 formatted text data (the response header contains Content-Type: application/json; charset=utf-8) and I have an iOS app that successfully consumes these web services. However using HTTPJob.GetString on the same web services results in a string that gets truncated at the same point every time and I'm wondering if there might be a character causing an issue. I've searched this forum and it seems I'm not the only one to experience this problem but it's not clear to me what the solution is when the character set is already utf-8.
Erel B4X founder Staff member Licensed User Longtime User Jun 16, 2016 #2 HttpJob.GetString doesn't truncate the text. Homerclese said: I've searched this forum and it seems I'm not the only one to experience this problem Click to expand... All of the issues you saw are related to the Log keyword which truncates the log message after 4000 characters (and prints a message that the string was truncated). You can check the length with: Code: Copy Dim s As String = HttpJob.GetString Log(s.Length) Upvote 0
HttpJob.GetString doesn't truncate the text. Homerclese said: I've searched this forum and it seems I'm not the only one to experience this problem Click to expand... All of the issues you saw are related to the Log keyword which truncates the log message after 4000 characters (and prints a message that the string was truncated). You can check the length with: Code: Copy Dim s As String = HttpJob.GetString Log(s.Length)
Homerclese Member Licensed User Longtime User Jun 16, 2016 #3 I didn't see any related to Log. The length being returned is under 800 characters so it's not that. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jun 16, 2016 #4 You can check the output with Log(HttpJob.GetString). Upvote 0
Homerclese Member Licensed User Longtime User Jun 16, 2016 #5 Ahh, OK. It does report that the message is longer than the Log limit. Which would be right because it is an array of records. I wasn't looking at it this way before. I was using a break point and copying it out of the debugger and it was being truncated to less than 800 characters so I assumed that this was the reason why JSONParser.Initialize couldn't handle it. Upvote 0
Ahh, OK. It does report that the message is longer than the Log limit. Which would be right because it is an array of records. I wasn't looking at it this way before. I was using a break point and copying it out of the debugger and it was being truncated to less than 800 characters so I assumed that this was the reason why JSONParser.Initialize couldn't handle it.
Homerclese Member Licensed User Longtime User Jun 16, 2016 #6 It was just my lack of understanding how the JSON serializer works in B4A. Sorry for the time wasting Erel...I wish I could delete this whole thread. Upvote 0
It was just my lack of understanding how the JSON serializer works in B4A. Sorry for the time wasting Erel...I wish I could delete this whole thread.