Rename the |utf8| variable in MetroUtils Log function: It holds an acp-encoded (not utf8-encoded) string

RESOLVED INCOMPLETE

Status

defect
--
trivial
RESOLVED INCOMPLETE
6 years ago
2 years ago

People

(Reporter: TimAbraldes, Unassigned)

Tracking

Trunk
x86_64
Windows 8.1

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: p=0)

Attachments

(1 attachment)

The Log function in MetroUtils currently converts unicode strings to the system codepage before passing them to PR_LOG.  It should convert them to UTF8.

Attached is an untested WIP patch.
Whiteboard: [metro-mvp?]
What does this work get us for v1 that we need?
This isn't necessary for v1.  The effect of this bug is likely just that certain characters will not appear correctly in some logs.
Assignee: tabraldes → nobody
Whiteboard: [metro-mvp?]
(In reply to Tim Abraldes (:tabraldes) from comment #0)
> The Log function in MetroUtils currently converts unicode strings to the
> system codepage before passing them to PR_LOG.  It should convert them to
> UTF8.

Why? I thought PR_LOG takes a string encoded in the system codepage on Windows.
(In reply to Masatoshi Kimura [:emk] from comment #3)
> (In reply to Tim Abraldes (:tabraldes) from comment #0)
> > The Log function in MetroUtils currently converts unicode strings to the
> > system codepage before passing them to PR_LOG.  It should convert them to
> > UTF8.
> 
> Why? I thought PR_LOG takes a string encoded in the system codepage on
> Windows.

What I really meant was that the code appears to be trying to convert a utf-16 string into a utf-8 string (since the variable it stores the result in is called "utf8"), but it is actually converting it to the system codepage.  If PR_LOG expects a string encoded in the system codepage then this code does what it is supposed to do (though the variable name should be changed).
(In reply to Tim Abraldes (:tabraldes) from comment #4)
> What I really meant was that the code appears to be trying to convert a
> utf-16 string into a utf-8 string (since the variable it stores the result
> in is called "utf8"), but it is actually converting it to the system
> codepage.  If PR_LOG expects a string encoded in the system codepage then
> this code does what it is supposed to do (though the variable name should be
> changed).

Wow, |utf8| is definitely a confusing name. Please change the name, rather than the behavior.
Updating title of bug
Severity: normal → trivial
Summary: Fix MetroUtils Log function to correctly handle unicode strings → Rename the |utf8| variable in MetroUtils Log function: It holds an acp-encoded (not utf8-encoded) string

Updated

6 years ago
No longer blocks: metrov1triage
Blocks: metrobacklog
Status: ASSIGNED → NEW
Whiteboard: p=0
OS: Windows 8 Metro → Windows 8.1
Mass close of bugs in obsolete product https://bugzilla.mozilla.org/show_bug.cgi?id=1350354
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.