Unable to use DBCS for print-to-file file name

RESOLVED FIXED in mozilla1.9alpha8

Status

()

RESOLVED FIXED
16 years ago
11 years ago

People

(Reporter: kasumi, Assigned: roland.mainz)

Tracking

(Blocks: 1 bug, {intl})

Trunk
mozilla1.9alpha8
x86
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
tested on 2002-07-02-07-1.0
Linux RedHat 7.1 JA

1. Launch Navigator
2. Select File/Print
3. Select Printer region/Print to/File
4. Click Coose File button then type file name having DBCS then
   click Save button
   You will see the corrupted file name or balnk file name for .ps 
   file

Comment 1

16 years ago
I am using our own file dialog for this, and I will need some L10N help with this...
Summary: Unable to use DBCS for .ps file name → Unable to use DBCS for .ps file name
(Reporter)

Comment 2

16 years ago
What can I do for you ?
(Assignee)

Comment 3

16 years ago
rods:
I "guess" that we do not convert the unicode filename string to the
users/machines current locale/encoding...
(Assignee)

Comment 4

16 years ago
Reporter:
Which encoding does your japanese linux use (e.g. PCK, UTF-8) ?

AFAIK we convert the file name from UCS2 to UTF-8 in some places instead of UTF2
to the platform's encoding...
(Assignee)

Comment 5

16 years ago
correction:
s/UTF2/UCS2/

Updated

16 years ago
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.1alpha

Comment 6

16 years ago
Roland, where are we do the UTF-8 conversions? Is it in the printing code or in
other file dialog code?

Updated

16 years ago
Target Milestone: mozilla1.1alpha → mozilla1.2beta
(Reporter)

Comment 7

16 years ago
charset is EUC-JP. This is default.
(Assignee)

Comment 8

16 years ago
rods wrote:
> Roland, where are we do the UTF-8 conversions? Is it in the printing code or 
> in other file dialog code?

In printing code, shattered over the whole gfx/ code. The problem is that we
don't have a simple NS_ConvertUCS2toFilesystemEncoding() (or similar) ...
somewhere I found that NS_ConvertUCS2toUTF8() was used and I followed the
example (which means all *.UTF-8 locales will work, but now locales like
ja_JP.PCK).

I can take the bug when someone tells me which macro I should use instead...
(Assignee)

Comment 9

16 years ago
darin:
We can't use |NS_CopyUnicodeToNative| from
http://lxr.mozilla.org/seamonkey/source/xpcom/io/nsNativeCharsetUtils.h , right
?

Comment 10

16 years ago
NS_CopyUnicodeToNative is currently only implemented for XP_UNIX.  I've been
meaning to complete its implementation (not hard).  See bug 166612.  One thing
about nsNativeCharsetUtils: it should only be used on file paths.

for the time being, i would recommend using nsIFile/nsILocalFile to do your
charset conversions.  sounds crufty, and it is, but it will do the trick.  once
NS_CopyUnicodeToNative is implemented, you'll be able to simplify your code. 
add some XXX comments, file a bug and mark it dependent on bug 166612 ;-)
(Assignee)

Comment 11

16 years ago
Darin Fisher wrote:
> NS_CopyUnicodeToNative is currently only implemented for XP_UNIX. 

The code we're talking about is Unix/Linux-only... :)

> I've been
> meaning to complete its implementation (not hard).  See bug 166612.  One thing
> about nsNativeCharsetUtils: it should only be used on file paths.
> for the time being, i would recommend using nsIFile/nsILocalFile to do your
> charset conversions.  sounds crufty, and it is, but it will do the trick.  
> once NS_CopyUnicodeToNative is implemented, you'll be able to simplify your 
> code. 
> add some XXX comments, file a bug and mark it dependent on bug 166612 ;-)

nsIFile/nsILocalFile cannot be used in this case (or we'll endup in rewriting
much code) since we are feeding pathnames to some APIs which want file _names_.

Since this issue is Unix/Linux-only I'd like to use NS_CopyUnicodeToNative()
(which is implemented on these platformss). Is that OK for you ?

Comment 12

16 years ago
in that case, using NS_CopyNativeToUnicode and NS_CopyUnicodeToNative should be
fine.
(Assignee)

Comment 13

16 years ago
Darin Fisher wrote:
> in that case, using NS_CopyNativeToUnicode and NS_CopyUnicodeToNative 
> should be fine.

Thanks!

----

rods:
Should I take this one ?

Comment 14

16 years ago
Yes, please do.
(Assignee)

Comment 15

16 years ago
Taking per comment #14 ...
Assignee: rods → Roland.Mainz
Status: ASSIGNED → NEW
(Assignee)

Comment 16

16 years ago
kasumi@netscape.com:
Can you check whether printing to file in a *.UTF8 locale (like ja_JP.UTF-8
etc.) works correctly ?
(Assignee)

Updated

16 years ago
Target Milestone: mozilla1.2beta → mozilla1.3alpha
(Reporter)

Comment 17

16 years ago
tested on 2002-09-30-06-1.0
locale = ja-JP.utf8

Doesn't work. A file having ascii as file name can't save in a folder having
DBCS as folder name either.
(Assignee)

Comment 18

16 years ago
Kasumi wrote:
> tested on 2002-09-30-06-1.0

Can you test it with "trunk", please ?

> locale = ja-JP.utf8

On which OS are you working on ?

> Doesn't work.

Weired. Are you sure that you've only used a file name with no path in front of
it ?

> A file having ascii as file name can't save in a folder having
> DBCS as folder name either.

OK, maybe we have two independant problems here... the conversion and maybe a
problem that |fopen()| doesn't like the input...
(Assignee)

Comment 19

16 years ago
Accepting bug...
Status: NEW → ASSIGNED
Target Milestone: mozilla1.3alpha → mozilla1.4alpha
(Assignee)

Comment 20

16 years ago
xpcom/io/nsNativeCharsetUtils.h isn't exported yet (bug 166612 ("implement
NS_CopyNativeToUnicode / NS_CopyUnicodeToNative on all platforms") will fix
that...) ...
Depends on: 166612
(Assignee)

Comment 21

16 years ago
Created attachment 101197 [details] [diff] [review]
Hacked(!!) prototype patch for 2002-09-29-08-trunk

5min hack patch for testing

ToDo:
- Bug 166612 ("implement NS_CopyNativeToUnicode / NS_CopyUnicodeToNative on all
platforms) needs to be fixed to get |NS_CopyNativeToUnicode()| and
|NS_CopyUnicodeToNative()| exported
- Bug 171809 ("RFE: Create |NS_ConvertUnicodeToNative| and
|NS_ConvertNativeToUnicode|") needs to be implemented to get rid of the hacked
versions in this patch
- Xlib toolkit needs to be patched
- PostScript and Xprint modules should use the unicode<-->native functions
where required, too
(Assignee)

Comment 22

16 years ago
Kasumi:
Can you test the patch if it fixes your problem (using both *.UTF-8 locale+UTF-8
filenames and the the same procedure with DBCS), please ?
(Reporter)

Comment 23

16 years ago
Roland:
Could you show me how to integrate this patch to test?
(Assignee)

Comment 24

16 years ago
Kasumi wrote:
> Could you show me how to integrate this patch to test?

Do you build yourself on Unix/Linux ?

If the answer is "yes" then you can simply apply the patch to your tree like
this:
1. Verify that the patch applies cleanly to the tree:
% gpatch -p0 --dry-run <attachment_cgi_id_101197_action_view
2. If [1] was successfull then remove the "--dry-run" switch and do the gpatch
again
3. Build the Zilla as usual
4. Test it
(Reporter)

Comment 25

16 years ago
Unfortunately my answer is "No".
How about in the case of "No"?
(Assignee)

Comment 26

16 years ago
Kasumi wrote:
> Unfortunately my answer is "No".
> How about in the case of "No"?

Well, I could make a build for you, but only for Solaris/SPARC (or the older
SuSE Linux 6.4/x86 - but I have no clue if such an old Linux build works with
DBCS) ...
(Assignee)

Comment 27

16 years ago
Does anyone else here have a DBCS-enabled Linux and can help testing the patch
(or knows someone who can help or knows someone who knows someone who can help ?
:) ?

Comment 28

16 years ago
cc Brian and Shanjian who may can help.
Keywords: intl

Comment 29

16 years ago
For printing issues would you kindly also cc: in the Sun developers:

Louie.Zhao@sun.com and pete.zha@sun.com 
(Assignee)

Updated

16 years ago
Summary: Unable to use DBCS for .ps file name → Unable to use DBCS for print-to-file file name
(Assignee)

Updated

16 years ago
Blocks: 204013
(Assignee)

Updated

15 years ago
Depends on: 171809
(Assignee)

Updated

15 years ago
Target Milestone: mozilla1.4alpha → mozilla1.9beta

Comment 30

11 years ago
The patch for bug 193001 should have rendered this moot. Gecko now uses the GTK printing system for print dialogs. If this is an issue with the GTK dialog, please open a new bug.
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.