* encoding.c (rb_filesystem_encoding): use ANSI codepage for file
system on cygwin. * encoding.c (rb_locale_charmap): reverted. [ruby-core:21110] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8dd121b5b7
commit
49ef25b151
@ -1,3 +1,10 @@
|
|||||||
|
Mon Jan 5 16:26:48 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* encoding.c (rb_filesystem_encoding): use ANSI codepage for file
|
||||||
|
system on cygwin.
|
||||||
|
|
||||||
|
* encoding.c (rb_locale_charmap): reverted. [ruby-core:21110]
|
||||||
|
|
||||||
Mon Jan 5 16:15:00 2009 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
Mon Jan 5 16:15:00 2009 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
* ext/curses/curses.c (free_window): use xfree instead of free.
|
* ext/curses/curses.c (free_window): use xfree instead of free.
|
||||||
|
21
encoding.c
21
encoding.c
@ -14,18 +14,15 @@
|
|||||||
#include "regenc.h"
|
#include "regenc.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#ifndef NO_LOCALE_CHARMAP
|
#ifndef NO_LOCALE_CHARMAP
|
||||||
#if defined __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif defined HAVE_LANGINFO_H
|
#endif
|
||||||
|
#ifdef HAVE_LANGINFO_H
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#include "ruby/util.h"
|
#include "ruby/util.h"
|
||||||
|
|
||||||
#if defined _WIN32 || defined __CYGWIN__
|
|
||||||
#define USE_CODEPAGE_LOCALE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static ID id_encoding;
|
static ID id_encoding;
|
||||||
VALUE rb_cEncoding;
|
VALUE rb_cEncoding;
|
||||||
static VALUE rb_encoding_list;
|
static VALUE rb_encoding_list;
|
||||||
@ -1033,8 +1030,12 @@ rb_encoding *
|
|||||||
rb_filesystem_encoding(void)
|
rb_filesystem_encoding(void)
|
||||||
{
|
{
|
||||||
rb_encoding *enc;
|
rb_encoding *enc;
|
||||||
#if defined USE_CODEPAGE_LOCALE
|
#if defined NO_LOCALE_CHARMAP
|
||||||
enc = rb_locale_encoding();
|
enc = rb_default_external_encoding();
|
||||||
|
#elif defined _WIN32 || defined __CYGWIN__
|
||||||
|
char cp[sizeof(int) * 8 / 3 + 4];
|
||||||
|
snprintf(cp, sizeof cp, "CP%d", GetACP());
|
||||||
|
enc = rb_enc_find(cp);
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__
|
||||||
enc = rb_enc_find("UTF8-MAC");
|
enc = rb_enc_find("UTF8-MAC");
|
||||||
#else
|
#else
|
||||||
@ -1212,12 +1213,12 @@ rb_locale_charmap(VALUE klass)
|
|||||||
{
|
{
|
||||||
#if defined NO_LOCALE_CHARMAP
|
#if defined NO_LOCALE_CHARMAP
|
||||||
return rb_usascii_str_new2("ASCII-8BIT");
|
return rb_usascii_str_new2("ASCII-8BIT");
|
||||||
#elif defined USE_CODEPAGE_LOCALE
|
|
||||||
return rb_sprintf("CP%d", GetACP());
|
|
||||||
#elif defined HAVE_LANGINFO_H
|
#elif defined HAVE_LANGINFO_H
|
||||||
char *codeset;
|
char *codeset;
|
||||||
codeset = nl_langinfo(CODESET);
|
codeset = nl_langinfo(CODESET);
|
||||||
return rb_usascii_str_new2(codeset);
|
return rb_usascii_str_new2(codeset);
|
||||||
|
#elif defined _WIN32
|
||||||
|
return rb_sprintf("CP%d", GetACP());
|
||||||
#else
|
#else
|
||||||
return Qnil;
|
return Qnil;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user