Bug 314709 - Clarify -encoding <encoding name> in jdt_api_compile.htm
Summary: Clarify -encoding <encoding name> in jdt_api_compile.htm
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Doc (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 trivial (vote)
Target Milestone: 3.6 RC4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords: Documentation
Depends on:
Blocks:
 
Reported: 2010-05-27 11:52 EDT by Dani Megert CLA
Modified: 2010-06-03 06:55 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (4.30 KB, patch)
2010-05-31 11:38 EDT, Olivier Thomann CLA
no flags Details | Diff
Complement with examples (1.79 KB, patch)
2010-06-02 10:02 EDT, Olivier Thomann CLA
no flags Details | Diff
Adding another example (1009 bytes, patch)
2010-06-02 10:19 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2010-05-27 11:52:21 EDT
3.6 RC4.

The '-encoding' entry for jdt_api_compile.htm needs clarification:

- how are custom encodings separated?
- the example says: X.java[utf8]
  - does that mean all X.java in all packages have UTF-8?
  - how does one qualify (path or package name)?
- "If multiple encodings are specified, the last one will be used."
  ==> should be last sentence
Comment 1 Olivier Thomann CLA 2010-05-31 10:07:45 EDT
Moving to JDT/Doc
Comment 2 Olivier Thomann CLA 2010-05-31 11:38:24 EDT
Created attachment 170543 [details]
Proposed fix

Does this improve the documentation ?
Comment 3 Olivier Thomann CLA 2010-06-01 11:22:42 EDT
Released for 3.6RC4.
Comment 4 Dani Megert CLA 2010-06-02 03:36:35 EDT
I still don't see how they should be separated (space, comma, semicolon?). I would provide an example with two files and one with a path so that it's already clear when just looking at the example.
Comment 5 Dani Megert CLA 2010-06-02 03:38:14 EDT
>If multiple default source file encodings are specified, the last one will be >used.
This is not 100% clear whether this is meant per "-encoding" or per each file.
Comment 6 Olivier Thomann CLA 2010-06-02 08:57:51 EDT
(In reply to comment #5)
> >If multiple default source file encodings are specified, the last one will be >used.
> This is not 100% clear whether this is meant per "-encoding" or per each file.
The default encoding is the one specified using -encoding. I'll try to improve it one last time.
Comment 7 Dani Megert CLA 2010-06-02 09:48:07 EDT
>The default encoding is the one specified using -encoding.
Sure, but what's not clear is what you want to say with the sentence. Let's look at this example:

-encoding X.java[utf8] ascii X.java[utf16] cp1252

What is the encoding of X.java now?

And in this case:
-encoding X.java[utf8] ascii  -encoding X.java[utf16] cp1252

?
Comment 8 Olivier Thomann CLA 2010-06-02 09:54:27 EDT
(In reply to comment #7)
> >The default encoding is the one specified using -encoding.
> Sure, but what's not clear is what you want to say with the sentence. Let's
> look at this example:
> -encoding X.java[utf8] ascii X.java[utf16] cp1252
This is an illegal syntax.
-encoding cp1252 -encoding ascii X.java[utf8] Y.java[utf16]

This is the right syntax. This means all source files are read with cp1252 encoding except X.java that will use utf8 and Y.java that will use utf16.
 
> What is the encoding of X.java now?
If you specify twice X.java on the command line you will get an error.

> And in this case:
> -encoding X.java[utf8] ascii  -encoding X.java[utf16] cp1252 ?
Same thing. Invalid syntax
Comment 9 Olivier Thomann CLA 2010-06-02 10:02:37 EDT
Created attachment 170802 [details]
Complement with examples

Complements released in HEAD.
Comment 10 Olivier Thomann CLA 2010-06-02 10:02:52 EDT
If ok, I'll close as FIXED.
Comment 11 Dani Megert CLA 2010-06-02 10:08:08 EDT
>-encoding cp1252 -encoding ascii X.java[utf8] Y.java[utf16]
>
>This is the right syntax. This means all source files are read with cp1252
>encoding except X.java that will use utf8 and Y.java that will use utf16.
Now I am really confused: The doc say:
   "If multiple encodings are specified, the last one will be used."

So, isn't 'ascii' specified after 'cp1252'?

And what happens if paths are there too, e.g.
-encoding cp1252 /foo/bar/X.java[utf8] /foo/bar[utf16]
Comment 12 Olivier Thomann CLA 2010-06-02 10:16:05 EDT
(In reply to comment #11)
> >-encoding cp1252 -encoding ascii X.java[utf8] Y.java[utf16]
> >
> >This is the right syntax. This means all source files are read with cp1252
> >encoding except X.java that will use utf8 and Y.java that will use utf16.
> Now I am really confused: The doc say:
>    "If multiple encodings are specified, the last one will be used."
> 
> So, isn't 'ascii' specified after 'cp1252'?
yes, right. ascii wins in this case.


> And what happens if paths are there too, e.g.
> -encoding cp1252 /foo/bar/X.java[utf8] /foo/bar[utf16]
Doesn't change anything. All units in /foo/bar will be read using utf16 except X.java  that will use utf8. In this case the last one doesn't mean as this is a specific encoding and not a default encoding.
Comment 13 Olivier Thomann CLA 2010-06-02 10:19:56 EDT
Created attachment 170805 [details]
Adding another example
Comment 14 Dani Megert CLA 2010-06-02 10:50:50 EDT
Looks good now!
Comment 15 Olivier Thomann CLA 2010-06-02 10:56:26 EDT
Thanks.
Closing as FIXED.
Comment 16 Dani Megert CLA 2010-06-03 06:55:11 EDT
Verified in I20100603-0100.