Hi Michael,
When serializing a string that has a null character inside it throws
the following exception:

System.FormatException occurred
  Message="Input string was not in a correct format."
  Source="mscorlib"
  StackTrace:
       at System.Number.StringToNumber(String str, NumberStyles
options, NumberBuffer& number, NumberFormatInfo info, Boolean
parseDecimal)
       at System.Number.ParseInt32(String s, NumberStyles style,
NumberFormatInfo info)
       at System.Int32.Parse(String s, NumberStyles style)
       at AjaxPro.JavaScriptUtil.QuoteString(String s, Char quoteChar)
       at AjaxPro.JavaScriptUtil.QuoteString(String s)
       at AjaxPro.StringConverter.Serialize(Object o)
       at AjaxPro.JavaScriptSerializer.Serialize(Object o)
       at
Newman.Web.Ajax.JSONConverters.RestrictedCustomConverter.Serialize(Object
o) in ***MY FILE***

this seems to be a bug with this section:
default:
   if (ch1 < ' ')
       {
       string text1 = "000" + int.Parse(new string(ch1, 1),
NumberStyles.HexNumber);
       builder1.Append(@"\u" + text1.Substring(text1.Length - 4));
       }

of AjaxPro.JavaScriptUtil.QuoteString(String,Char):String
(code extracted via Lutz Roeder's .NET Reflector)

I think that something like:

       string text1 = "000" + (byte)ch1;
       builder1.Append(@"\u" + text1.Substring(text1.Length - 4));

should do the work, as ch1 is < ' ' (i.e. < 32) and can be cast to a
byte.


This all all with AjaxPro.2, Version=6.7.20.1.


Eyal Peleg.

b.t.w - I would still like to hear from you on this issue:
http://groups.google.com/group/ajaxpro/browse_thread/thread/ddebd31056a50efe


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info/

Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
-~----------~----~----~----~------~----~------~--~---

Reply via email to