Closed Bug 385805 Opened 17 years ago Closed 9 years ago

Localized module name in Security Manager looks garbled

Categories

(Core Graveyard :: Security: UI, defect)

1.8 Branch
x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 496005

People

(Reporter: unghost, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; ru; rv:1.9a6pre) Gecko/20070624 Minefield/3.0a6pre
Build Identifier: 

If "loaddevice.modname.default" in
http://lxr.mozilla.org/mozilla/source/security/manager/locales/en-US/chrome/pippki/deviceManager.dtd
is localized and if user had accepted this default name as module name, it
displayed later as garbage.


Reproducible: Always

Steps to Reproduce:
1.Setup Firefox 2.0.0.4 Russian
2.Create new profile
3.Add new module with cyrillic name (you can accept default name)
4.Name of module is displayed as garbage.
Actual Results:  
Name of module is displayed as garbage.

Expected Results:  
Name of module is displayed in Cyrillic letters.
nsPkcs11::Addmodule(const nsAString& aModuleName,
                    const nsAString& aLibraryFullPath,
                    PRInt32 aCryptoMechanismFlags,
                    PRInt32 aCipherFlags, PRInt32* aReturn)

Parameter 1, aModuleName.

I suspect this module name must be a UTF-8 string.

This function is using a very basic approach to convert the 16 bit UCS2 string to a plain C string. It calls ToNewCString from nsReadableUtils.h which has this comment:


/**
 * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
 *
 * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|.
 * Performs a lossy encoding conversion by chopping 16-bit wide characters down to 8-bits wide while copying |aSource| to your new buffer.
 * This conversion is not well defined; but it reproduces legacy string behavior.
 * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
 *
 * @param aSource a 16-bit wide string
 * @return a new |char| buffer you must free with |nsMemory::Free|.
 */

So maybe there is no useful translation from your cyrillic (?) chars to ascii.

The challenge is to enhance this function with a better conversion, maybe using a UCS-2 to UTF-8 conversion?

But note the string might be limited to an UTF-8 string with an encoded storage size of either 32 or 64 bytes.
reassign bug owner.
mass-update-kaie-20120918
Assignee: kaie → nobody
AFAICT, this was fixed as part of Bug 496005.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: