--- ./json-glib-0.10.2/json-glib/json-scanner.c	2009-09-21 19:31:05.000000000 +0700
+++ ./json-glib-0.10.2-1/json-glib/json-scanner.c	2010-07-28 03:43:17.952240853 +0700
@@ -891,8 +891,9 @@
       else
         break;
     }
-
-  g_assert (g_unichar_validate (uchar));
+	/*jagad: check surrogate */
+	if ( g_unichar_type(uchar) != G_UNICODE_SURROGATE )
+	  g_assert (g_unichar_validate (uchar));
 
   return uchar;
 }
@@ -1436,10 +1437,37 @@
                           fchar = json_scanner_peek_next_char (scanner);
                           if (is_hex_digit (fchar))
                             {
-                              gunichar ucs;
-
+															gunichar ucs;
+															/*jagad: make it support surrogate */	
                               ucs = json_scanner_get_unichar (scanner, line_p, position_p);
-                              gstring = g_string_append_unichar (gstring, ucs);
+															if ( g_unichar_type(ucs) == G_UNICODE_SURROGATE )
+															{
+																fchar = json_scanner_peek_next_char (scanner);
+																if ( fchar == '\\' ) 
+																{
+																	fchar = json_scanner_get_char (scanner, line_p, position_p); /* in '\' */
+																	fchar = json_scanner_get_char (scanner, line_p, position_p); /* in 'u'*/
+																	fchar = json_scanner_peek_next_char (scanner);
+																}
+																if ( !is_hex_digit (fchar) ) break;
+
+																gunichar2 ucs2[3];
+																ucs2[0] = ucs;
+																ucs2[2] = 0;
+ 
+																ucs2[1] = json_scanner_get_unichar (scanner, line_p, position_p);
+																if (ucs2[1] == 0) break; /*avoid SEGFAULT in GLib ;)*/
+																																
+																gchar *uc_utf8;
+																uc_utf8 = g_utf16_to_utf8(ucs2, -1, NULL, NULL, NULL);
+																g_assert ( uc_utf8 != 0x0 );
+								
+																gstring = g_string_append_unichar(gstring, g_utf8_get_char(uc_utf8));
+
+																g_free(uc_utf8);
+															}
+															else 
+																gstring = g_string_append_unichar (gstring, ucs);
                             }
                           break;
 			  
