Closed Bug 60823 Opened 24 years ago Closed 24 years ago

UnicodeToGBK and UnicodeToGB2312 converter don't work on SPARC Solaris

Categories

(Core :: Internationalization, defect, P1)

Sun
Solaris
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: masaki.katakai, Assigned: shanjian)

References

Details

(Keywords: intl)

Attachments

(3 files)

nsUnicodeToGBK.cpp and nsUnicodeToGB2312V2.cpp don't work
for ASCII characters on SPARC Solaris. Please try the following,

 ./nsconv -f utf-8 -t x-gbk

When you type ascii characters, but it doesn't return.

On SPARC Solaris platform, Mozilla could not create
new profile under user's home directory in zh.GBK locale
but created MOZILLA_HOME/default_prefs.js.

After debugging, I found NS_NewUnicodeLocalFile() in zh.GBK locale.

This will convert UNICODE to native encoding. The target
string is very simple, e.g. "/home/katakai/.mozilla" but
it fails and returns "".

It seems that nsUnicodeToGBK.cpp and nsUnicodeToGB2312V2.cpp
uses leftbyte when the input is ASCII, but it doesn't work
on SPARC platform.

I'll attach the simple patch for this problem. Please evaluate.
Katakai san, I assign this to you since you have a patch, cc to erik, bstell.
Assignee: nhotta → katakai
The fix is correct, but I would prefer the following:

  *aDest++ = *pSrc;

r=erik
Blocks: 60916
Hotta-san, can you check-in this change for me?
I've requested CVS access but I could not get yet.
Please get a super review then I can check in.

http://www.mozilla.org/hacking/reviewers.html
Hi, Masaki-san:

Please resubmit a patch w/ Erik's suggestion and get a review from cata and
super-review from Erik.

thx
Attached patch revised patchSplinter Review
Hi, Erik and Naoki:


Would you review (sr) the proposed patch ?



thx
sr=erik
Why *aDest = pSrcDBCode->leftbyte; does not work on SPARC?

SPARC is big-endian, while Intel is little-endian. The data is in little-endian
double-byte Unicode (shorts), but the code is applying a struct that has
leftbyte first, so it doesn't work.
Sorry, what I meant to say, was: The data is in little-endian Unicode only on
Intel, so the struct with leftbyte will work there, but the data is big-endian
on SPARC, so the struct does not work there.
I found the same problem on HP (bug 61466). I will mark 61466 as a duplicated one.
Katakai, please use type cast before assignment, that will avoid some compiler 
warning. ie.  *aDest++ = (char)*pSrc;
If you can check it into trunk, please do it. Otherwise reassign it to me.
thanks!

r=nhotta, please include shanjian's comment
I couldn't still get a permission for check-in. Reassign to Shanjian.
Assignee: katakai → shanjian
*** Bug 61466 has been marked as a duplicate of this bug. ***
Blocks: 18687
Blocks: 52139
Hi, Katakai-san:

We got r=nhotta & sr=erik for the proposed patch. Is there anything else
to be done?
Status: NEW → ASSIGNED
Fix has been checked in to trunk and OEM branch. 
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Blocks: 60740
integrated into OEM branch. Tao, Shanjian, thank you very much for your help.
Changed QA Contact to katakai@japan.sun.com.
QA Contact: teruko → katakai
Verified fix on the latest build on Solaris SPARC.
Status: RESOLVED → VERIFIED
Adding intl and nsbeta1 keywords.

Adding mcarlson to cc-list.
Keywords: intl, nsbeta1
Priority: P3 → P1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: