strconv.Unquote returns invalid syntax if the string contains `"`. It is
better to quote string before Unquote.
https://go.dev/play/p/ndfEi9tSjaM
On Thursday, December 29, 2016 at 7:44:07 AM UTC+8 Jakob Borg wrote:
Both json.Unmarshal and strconv.Unquote seem to handle this fine:
https://play.
Both json.Unmarshal and strconv.Unquote seem to handle this fine:
https://play.golang.org/p/mexmJNGQyh
//jb
> On 28 Dec 2016, at 15:03, JohnGB wrote:
>
> I tried this with a variety of messages, and it doesn't work with most
> unicode escaped string. For example, the unicode escaped string
My response should have read that it produces an error of "invalid
character 'Ñ' looking for beginning of value". I got the responses from
the two methods mixed up.
On Monday, 26 December 2016 17:32:56 UTC+1, rog wrote:
>
> On 26 December 2016 at 07:23, JohnGB >
> wrote:
> > It *should* have
I tried this with a variety of messages, and it doesn't work with most
unicode escaped string. For example, the unicode escaped string
'\u044d\u0442\u043e \u0442\u0435\u0441\u0442
\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435' should unescape to
'это тест сообщение' but it unescapes t
I tried this with a variety of messages, and it doesn't work with most
unicode escaped string. For example, the unicode escaped string
'\u044d\u0442\u043e \u0442\u0435\u0441\u0442
\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435' should unescape to
'это тест сообщение' but it unescapes t
That look like a nice solution. I'll have to benchmark the methods and see
which one wins out in the end.
On Monday, 26 December 2016 19:34:16 UTC+1, C Banning wrote:
>
> If you're processing anonymous messages and don't know where unicode will
> occur you might want something like this:
> htt
If you're processing anonymous messages and don't know where unicode will
occur you might want something like
this: https://play.golang.org/p/M-21sy_en5
On Monday, December 26, 2016 at 9:41:15 AM UTC-7, JohnGB wrote:
>
> Thanks Roger. That is a really elegant solution.
>
> On 26 December 2016 a
Thanks Roger. That is a really elegant solution.
On 26 December 2016 at 17:32, roger peppe wrote:
> On 26 December 2016 at 07:23, JohnGB wrote:
> > It *should* have a JSON body, but in this particular case I can't be sure
> > that it will, as I'm trying to log requests when there are errors, w
On 26 December 2016 at 07:23, JohnGB wrote:
> It *should* have a JSON body, but in this particular case I can't be sure
> that it will, as I'm trying to log requests when there are errors, which are
> quite often errors in the request. So although in some cases it is decoded
> later in the handle
It *should* have a JSON body, but in this particular case I can't be sure
that it will, as I'm trying to log requests when there are errors, which
are quite often errors in the request. So although in some cases it is
decoded later in the handler chain, I need to be able to log the string in
a
If it has a JSON body, are you using encoding/json to parse / decode it?
That will handle the unescaping for you.
On Sat, Dec 24, 2016 at 4:54 PM JohnGB wrote:
> I have an application where I am processing a HTTP request with a JSON
> body. However, the JSON in the body has been unicode escaped
11 matches
Mail list logo