home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
OnlineVideos
JSON help needed from devs
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="corporate_gadfly" data-source="post: 845597" data-attributes="member: 113254"><p>Looks like Newtonsoft.Json does not support <a href="http://mathiasbynens.be/notes/javascript-escapes" target="_blank">hexadecimal escape sequences</a> (or octal escape sequences for that matter). I would be willing to try <a href="http://json.codeplex.com/discussions/244265" target="_blank">this patch</a> at least for the hexadecimal support (don't care about the octal part at the moment).</p><p> </p><p><s>Thoughts?</s></p><p> </p><p>Following patch works:</p><p>[CODE]Index: OnlineVideos/Newtonsoft.Json/JsonTextReader.cs</p><p>===================================================================</p><p>--- OnlineVideos/Newtonsoft.Json/JsonTextReader.cs (revision 1935)</p><p>+++ OnlineVideos/Newtonsoft.Json/JsonTextReader.cs (working copy)</p><p>@@ -132,6 +132,19 @@</p><p> char hexChar = Convert.ToChar(int.Parse(new string(hexValues), NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo));</p><p> _buffer.Append(hexChar);</p><p> break;</p><p>+ case 'x':</p><p>+ hexValues = new char[2];</p><p>+ for (int i = 0; i < hexValues.Length; i++)</p><p>+ {</p><p>+ if ((currentChar = MoveNext()) != '\0' || !_end)</p><p>+ hexValues[i] = currentChar;</p><p>+ else</p><p>+ throw CreateJsonReaderException("Unexpected end while parsing hexadecimal escape sequence. Line {0}, position {1}.", _currentLineNumber, _currentLinePosition);</p><p>+ }</p><p>+</p><p>+ hexChar = Convert.ToChar(int.Parse(new string(hexValues), NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo));</p><p>+ _buffer.Append(hexChar);</p><p>+ break;</p><p> default:</p><p> throw CreateJsonReaderException("Bad JSON escape sequence: {0}. Line {1}, position {2}.", @"\" + currentChar, _currentLineNumber, _currentLinePosition);</p><p> }</p><p>[/CODE]</p><p>Any protocol for updating Newtonsoft.JSON that I should follow?</p></blockquote><p></p>
[QUOTE="corporate_gadfly, post: 845597, member: 113254"] Looks like Newtonsoft.Json does not support [URL='http://mathiasbynens.be/notes/javascript-escapes']hexadecimal escape sequences[/URL] (or octal escape sequences for that matter). I would be willing to try [URL='http://json.codeplex.com/discussions/244265']this patch[/URL] at least for the hexadecimal support (don't care about the octal part at the moment). [S]Thoughts?[/S] Following patch works: [CODE]Index: OnlineVideos/Newtonsoft.Json/JsonTextReader.cs =================================================================== --- OnlineVideos/Newtonsoft.Json/JsonTextReader.cs (revision 1935) +++ OnlineVideos/Newtonsoft.Json/JsonTextReader.cs (working copy) @@ -132,6 +132,19 @@ char hexChar = Convert.ToChar(int.Parse(new string(hexValues), NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo)); _buffer.Append(hexChar); break; + case 'x': + hexValues = new char[2]; + for (int i = 0; i < hexValues.Length; i++) + { + if ((currentChar = MoveNext()) != '\0' || !_end) + hexValues[i] = currentChar; + else + throw CreateJsonReaderException("Unexpected end while parsing hexadecimal escape sequence. Line {0}, position {1}.", _currentLineNumber, _currentLinePosition); + } + + hexChar = Convert.ToChar(int.Parse(new string(hexValues), NumberStyles.HexNumber, NumberFormatInfo.InvariantInfo)); + _buffer.Append(hexChar); + break; default: throw CreateJsonReaderException("Bad JSON escape sequence: {0}. Line {1}, position {2}.", @"\" + currentChar, _currentLineNumber, _currentLinePosition); } [/CODE] Any protocol for updating Newtonsoft.JSON that I should follow? [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
OnlineVideos
JSON help needed from devs
Contact us
RSS
Top
Bottom