<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2568,8 +2568,8 @@ __append_escape(CFMutableStringRef out, UniChar c)
     __append(out, c);
 }
 
-VALUE
-rb_str_inspect(VALUE str, SEL sel)
+static VALUE
+__rb_str_inspect(VALUE str, bool dump)
 {
     const long len = CFStringGetLength((CFStringRef)str);
     CFStringInlineBuffer buf; 
@@ -2578,13 +2578,21 @@ rb_str_inspect(VALUE str, SEL sel)
     CFMutableStringRef out = CFStringCreateMutable(NULL, 0);
     __append(out, '&quot;');
 
-    long i;
-    for (i = 0; i &lt; len; i++) {
+    for (long i = 0; i &lt; len; i++) {
 	UniChar c = CFStringGetCharacterFromInlineBuffer(&amp;buf, i);
 	if (iswprint(c)) {
 	    if (c == '&quot;'|| c == '\\') {
 		__append_escape(out, c);
 	    }
+	    else if (dump &amp;&amp; c == '#' &amp;&amp; i + 1 &lt; len) {
+		UniChar c2 = CFStringGetCharacterFromInlineBuffer(&amp;buf, i + 1);
+		if (c2 == '$' || c2 == '@' || c2 == '{') {
+		    __append_escape(out, c);
+		}
+		else {
+		    __append(out, c);
+		}
+	    }
 	    else {
 		__append(out, c);
 	    }
@@ -2626,7 +2634,11 @@ rb_str_inspect(VALUE str, SEL sel)
     return res;
 }
 
-#define IS_EVSTR(p,e) ((p) &lt; (e) &amp;&amp; (*(p) == '$' || *(p) == '@' || *(p) == '{'))
+VALUE
+rb_str_inspect(VALUE str, SEL sel)
+{
+    return __rb_str_inspect(str, false);
+}
 
 /*
  *  call-seq:
@@ -2639,9 +2651,7 @@ rb_str_inspect(VALUE str, SEL sel)
 static VALUE
 rb_str_dump(VALUE str, SEL sel)
 {
-    // XXX #dump and #inspect have some slight differences, let's fix that
-    // later.
-    VALUE res = rb_str_inspect(str, 0);
+    VALUE res = __rb_str_inspect(str, true);
     *(VALUE *)res = *(VALUE *)str;
     return res;
 }</diff>
      <filename>string.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0081a7194dd7cb878cd0011e3220b7b17b24e3ea</id>
    </parent>
  </parents>
  <author>
    <name>lsansonetti@apple.com</name>
    <email>lsansonetti@apple.com@23306eb0-4c56-4727-a40e-e92c0eb68959</email>
  </author>
  <url>http://github.com/masterkain/macruby/commit/81288cd339d535bac6337e05dfe16e92aa6cfae6</url>
  <id>81288cd339d535bac6337e05dfe16e92aa6cfae6</id>
  <committed-date>2009-11-09T20:44:17-08:00</committed-date>
  <authored-date>2009-11-09T20:44:17-08:00</authored-date>
  <message>fixed String#dump to escape eval strings

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@2988 23306eb0-4c56-4727-a40e-e92c0eb68959</message>
  <tree>8cdf4c2535e8db8484400be594f342cb54f53d98</tree>
  <committer>
    <name>lsansonetti@apple.com</name>
    <email>lsansonetti@apple.com@23306eb0-4c56-4727-a40e-e92c0eb68959</email>
  </committer>
</commit>
