@@ -451,6 +451,15 @@ function startsWith(string, startString) {
451
451
return string . substr ( 0 , startString . length ) === startString ;
452
452
}
453
453
454
+ /**
455
+ * Unicode to ASCII (encode data to Base64)
456
+ * @param {string } data
457
+ * @return {string }
458
+ */
459
+ function utoa ( data ) {
460
+ return btoa ( unescape ( encodeURIComponent ( data ) ) ) ;
461
+ }
462
+
454
463
Profile . prototype = {
455
464
reset : function ( ) {
456
465
$ ( this . element ) . empty ( ) ;
@@ -470,7 +479,7 @@ Profile.prototype = {
470
479
} ,
471
480
472
481
_fetch_and_display : function ( fname , then ) {
473
- fname_encoded = btoa ( fname )
482
+ fname_encoded = utoa ( fname )
474
483
this . function_name = fname_encoded ;
475
484
var this_ = this ;
476
485
$ . ajax ( g_urls . getCodeForFunction , {
@@ -1078,7 +1087,10 @@ function FunctionTypeahead(element, options) {
1078
1087
// FIXME: the item isn't passed in as json any more, it's
1079
1088
// been rendered. Lame. Hack around this by splitting apart
1080
1089
// the ','-concatenated 2-tuple again.
1081
- fname = item . split ( ',' ) [ 0 ] ;
1090
+ // tamar: with C++ symbols demangled we have natural ,s in the
1091
+ // string so we can't blindly lop off ,. Instead lets just
1092
+ // do a safer substring on ,[object Object].
1093
+ fname = item . substr ( 0 , item . length - ",[object Object]" . length ) ;
1082
1094
1083
1095
options . updated ( fname ) ;
1084
1096
return fname ;
0 commit comments