Closed Bug 393119 Opened 17 years ago Closed 14 years ago

XPConnect's Dump doesn't do string conversions correctly

Categories

(Core :: XPConnect, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: hello, Assigned: hello)

References

(Depends on 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

Attached patch XPConnect Dump patch (obsolete) — Splinter Review
It breaks on UTF-16 strings, because it gets bytes instead of chars, and just prints them directly.

The attached patch solves the problem.

Test case:

I have an ini file like:

[foo]
cheese=チーズが好きですか。

And some code like this (iniFile is an nsILocalFile):

var ini = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
  getService(Ci.nsIINIParserFactory).createINIParser(iniFile);
var cheese = ini.getString("foo", "cheese");
dump(cheese + "\n");

And I see garbage on the terminal (using OS X's Terminal.app).
Depends on: 393121
I think we want to make XPConnect's dump assume the console is UTF-8 (that is, take this patch) since:

 1) it matches what window.dump does in chrome, and it's confusing to have those behave differently.

 2) I think most modern consoles are UTF-8 (Mac OS X, most modern Linux distros), and if they're not, you're probably not going to be able to usefully print most non-ASCII stuff anyway.

You should request r+sr from jst, I think.
Attachment #277632 - Flags: superreview?(jst)
Attachment #277632 - Flags: review?(jst)
Assignee: nobody → thunder
Attachment #277632 - Flags: superreview?(jst)
Attachment #277632 - Flags: superreview+
Attachment #277632 - Flags: review?(jst)
Attachment #277632 - Flags: review+
This bug just hit mhanson.  I no longer have a mozilla tree set up, if any of you wouldn't mind checking that the patch still applies and commit it, I'll owe you a hug.  Or a beer.  Up to you.
Attached patch Updated to trunkSplinter Review
The patch didn't apply... so I updated it.
Attachment #277632 - Attachment is obsolete: true
Attachment #434082 - Flags: superreview+
Attachment #434082 - Flags: review+
The tree is metered right now so I can't check in. But hopefully someone will come along and check the updated patch in.
Keywords: checkin-needed
Yay! Hugs for mrbkap!
http://hg.mozilla.org/mozilla-central/rev/3a91d9ba7f22
Status: NEW → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Attached patch mingw fixSplinter Review
This patch broke mingw compilation where wchar_t != unsigned short. The attached patch fixes the problem.
Attachment #435135 - Flags: review?(mrbkap)
Attachment #435135 - Flags: review?(mrbkap) → review+
Keywords: checkin-needed
Reopening... I'm not sure if our checkin-needed fairies check FIXED bugs.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
http://hg.mozilla.org/mozilla-central/rev/7019e5fc3ede
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: