Feature #5206
closedruby -K should warn
Description
When ruby is run with -K it changes the default encoding of all files even when that may be incompatible with the source. If many libraries are used -K may cause incorrect behavior.
Now that we have the "coding:" magic comment ruby should warn if the -K flag is used and suggest that "coding:" magic comment be used instead.
Updated by kosaki (Motohiro KOSAKI) about 13 years ago
When ruby is run with -K it changes the default encoding of all files even when that may be incompatible with the source. Â If many libraries are used -K may cause incorrect behavior.
Now that we have the "coding:" magic comment ruby should warn if the -K flag is used and suggest that "coding:" magic comment be used instead.
+1.
Updated by mame (Yusuke Endoh) over 12 years ago
- Status changed from Open to Assigned
- Assignee set to naruse (Yui NARUSE)
Naruse-san, what do you think?
--
Yusuke Endoh mame@tsg.ne.jp
Updated by naruse (Yui NARUSE) over 12 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r36274.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- ruby.c (proc_options): warn if -K option is specified. [Feature #5206]
Updated by usa (Usaku NAKAMURA) over 12 years ago
- Status changed from Closed to Assigned
I think that it is good for warning, but isn't only the time of -w option being specified?
Updated by ko1 (Koichi Sasada) over 12 years ago
(2012/07/03 14:46), usa (Usaku NAKAMURA) wrote:
Status changed from Closed to Assigned
I think that it is good for warning, but isn't only the time of -w option being specified?
I often use -Ks option for temporary ruby scripts because my editor's
default encoding is CP932. And I always run ruby scripts with -w option.
I'm happy if there are any other way to specify script encoding for such
disposable scripts.
--
// SASADA Koichi at atdot dot net
Updated by naruse (Yui NARUSE) over 12 years ago
- Assignee changed from naruse (Yui NARUSE) to matz (Yukihiro Matsumoto)
ko1 (Koichi Sasada) wrote:
(2012/07/03 14:46), usa (Usaku NAKAMURA) wrote:
Status changed from Closed to Assigned
I think that it is good for warning, but isn't only the time of -w option being specified?
I often use -Ks option for temporary ruby scripts because my editor's
default encoding is CP932. And I always run ruby scripts with -w option.I'm happy if there are any other way to specify script encoding for such
disposable scripts.
If ALLOW_DEFAULT_SOURCE_ENCODING macro is enabled, you can use --source-encoding option.
Updated by ko1 (Koichi Sasada) over 12 years ago
(2012/07/04 22:42), naruse (Yui NARUSE) wrote:
If ALLOW_DEFAULT_SOURCE_ENCODING macro is enabled, you can use --source-encoding option.
Do you mean that I should use modified ruby package instead of using
prepared package such as distributor's build or Windows installer's build?
--
// SASADA Koichi at atdot dot net
Updated by naruse (Yui NARUSE) over 12 years ago
- Status changed from Assigned to Closed
This issue was solved with changeset r36310.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- ruby.c (proc_options): warn only if -K and -w option is specified.
see also r36274 [Feature #5206]
Updated by naruse (Yui NARUSE) over 12 years ago
- Status changed from Closed to Assigned
Updated by naruse (Yui NARUSE) over 12 years ago
ko1 (Koichi Sasada) wrote:
(2012/07/04 22:42), naruse (Yui NARUSE) wrote:
If ALLOW_DEFAULT_SOURCE_ENCODING macro is enabled, you can use --source-encoding option.
Do you mean that I should use modified ruby package instead of using
prepared package such as distributor's build or Windows installer's build?
Or get permission from matz to add the new option.
Updated by ko1 (Koichi Sasada) over 12 years ago
(2012/07/05 1:02), naruse (Yui NARUSE) wrote:
Or get permission from matz to add the new option.
How about it, matz?
I think it is considerable feature with [ruby-core:46021] (*1),
(*1) [ruby-core:46021] [ruby-trunk - Feature #6679][Open] Default Ruby
source file encoding to utf-8
--
// SASADA Koichi at atdot dot net
Updated by mame (Yusuke Endoh) almost 12 years ago
- Target version set to 2.6
Updated by naruse (Yui NARUSE) over 6 years ago
- Status changed from Assigned to Closed
Keep compatibility for a while.
Updated by naruse (Yui NARUSE) over 6 years ago
It warns as follows on -w option:
ruby: warning: -K is specified; it is for 1.8 compatibility and may cause odd behavior