ページのタイトルとURLからaタグを生成するブックマークレット

ブログを書いていると参照ページへのリンクを載せたいと思うことが多いです。
URLはブラウザに表示されているのをコピーすればよいのですが、ページタイトルを取得するにはいくつかの手順が必要でした。で、ブックマークレットで一発でやりたいなぁと思っていたらありました。


内容はこちら↓のページをご参照ください。
ブックマークレットでページのタイトルとリンクを取得 (でぃべろっぱーず・さいど)

これでブログの更新がちょっと楽になるかな。

かなり楽になりそうです。ありがとうございます。

参考にしているものリスト

まるごとPerl! Vol.1

まるごとPerl! Vol.1

catalystのサンプルがあります。dankogaiさんのエンコードの記事はまだきちんと読んでいませんが、今後参考にすべき内容だと思っています。


WEB+DB PRESS 総集編 [Vol.1~36]

WEB+DB PRESS 総集編 [Vol.1~36]

付属CDを目当てに買いました。id:naoyaさんの記事もあります。


Perl言語プログラミングレッスン 入門編

Perl言語プログラミングレッスン 入門編

2006年度の新版も読みたいのですが、図書館には2001年度版しかなかったので借りて読んでいます。
ざっくり読んで、あとはふとわからない事があったときにリファレンスしています。


Effective Perl (ASCII Addison Wesley Programming Series)

Effective Perl (ASCII Addison Wesley Programming Series)

パッケージやモジュールの章が読みたくて買いました。

MySQLの準備

参考サイト
MySQLクイック・リファレンス

DB作成

# mysql create test
# mysqlshow 
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+

テーブル作成

# mysql test < c_bookmark.sql
# mysql test
mysql> desc bookmark
    -> ;
+-------------+--------------+------+-----+-------------------+----------------+
| Field       | Type         | Null | Key | Default           | Extra          |
+-------------+--------------+------+-----+-------------------+----------------+
| bookmark_id | int(11)      | NO   | PRI | NULL              | auto_increment | 
| url         | varchar(255) | YES  |     | NULL              |                | 
| title       | varchar(255) | YES  |     | NULL              |                | 
| record_time | timestamp    | NO   |     | CURRENT_TIMESTAMP |                | 
| comment     | text         | YES  |     | NULL              |                | 
+-------------+--------------+------+-----+-------------------+----------------+
5 rows in set (0.00 sec)

MySQLのコマンドわかんね。覚えること多すぎ(^^;

Catalyst::Plugin::Charsets::Japaneseのインストール

参考サイト
http://www.tyzoh.jp/modules/weblog/details.php?blog_id=1257<<

インストール

エラー発生

# perl -MCPAN -e "install Catalyst::Plugin::Charsets::Japanese"
・・・省略
#   Failed test at t/11_utf_to_euc.t line 27.
Wide character in print at /usr/lib/perl5/5.8.8/Test/Builder.pm line 1265.
#          got: "日本語"
#       length: 3
#     expected: "\x{e6}\x{97}\x{a5}\x{e6}\x{9c}\x{ac}\x{e8}\x{aa}\x{9e}"
#       length: 9
#     strings begin to differ at char 1
# Looks like you failed 1 test of 4.
t/11_utf_to_euc......dubious                                                 
        Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 4
        Failed 1/4 tests, 75.00% okay
Failed Test         Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/03_sjis_to_euc.t     1   256     4    1  4
t/04_sjis_to_utf8.t    1   256     4    1  4
t/05_sjis_to_sjis.t    1   256     4    1  4
t/06_euc_to_euc.t      1   256     4    1  4
t/07_euc_to_utf8.t     1   256     4    1  4
t/08_euc_to_sjis.t     1   256     4    1  4
t/09_utf_to_euc.t      1   256     4    1  4
t/10_utf_to_utf.t      1   256     4    1  4
t/11_utf_to_euc.t      1   256     4    1  4
Failed 9/12 test scripts. 9/161 subtests failed.
Files=12, Tests=161, 12 wallclock secs ( 5.82 cusr +  5.38 csys = 11.20 CPU)
Failed 9/12 test programs. 9/161 subtests failed.
make: *** [test_dynamic] エラー 1
  LYOKATO/Catalyst-Plugin-Charsets-Japanese-0.06.tar.gz
  /usr/bin/make test -- NOT OK
Running make install
  make test had returned bad status, won't install without force

上記のエラーが出てしまう。そういえば、httpdのerror_logも文字化けがしていたっけ。
結局解決できずに放置していたのですが、下記が怪しいのかな?と思って試してみました。

# yum groupinstall 'Japanese Support'
・・・中略
Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size 
=============================================================================
Installing:
 anthy                   i386       8700b-1.fc6      updates           5.6 M
 fonts-japanese          noarch     0.20061016-1.fc6  updates            29 M
 kcc                     i386       2.3-24.2.2       core               26 k
 lv                      i386       4.51-8.1         core              423 k
 man-pages-ja            noarch     20060815-2       core              5.0 M
 nkf                     i386       2.07-1.1.fc6     core              109 k
 perl-NKF                i386       2.07-1.1.fc6     core              118 k
 scim-anthy              i386       1.2.4-1.fc6      updates           363 k
 scim-bridge-gtk         i386       0.4.10-1.fc6     updates            37 k
Installing for dependencies:
 kasumi                  i386       2.2-4.fc6        updates            91 k
 scim                    i386       1.4.4-37.fc6     updates           524 k
 scim-bridge             i386       0.4.10-1.fc6     updates            97 k
 scim-libs               i386       1.4.4-37.fc6     updates           463 k

Transaction Summary
=============================================================================
Install     13 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 41 M
Is this ok [y/N]:y                  <=★y
・・・中略
Complete!

結局

関係なかったようです。再度下記を実行しましたが同じエラーが出ました。

>|sh|
# perl -MCPAN -e "install Catalyst::Plugin::Charsets::Japanese"

なので、無視してforce インストールしてしましました。
これがどのような影響になるのかわかりませんが。

Catalystをインストール

参考サイト
インプレスブックス - 本、雑誌と関連Webサービスの"使ってわかるCatalyst"
Catalystに必要なもの - 徒委記
門前の小僧、Plaggerに手をだす。 - なんちゃってSEの日々
http://cramoty.blog83.fc2.com/blog-entry-11.html
2007-05-09

Module::FindとPath:Classを先にインストールします。

# perl -MCPAN -e "install Module::Find"
CPAN: Storable loaded ok
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
  ftp://ftp.kddilabs.jp/CPAN/authors/01mailrc.txt.gz
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
LWP not available
Fetching with Net::FTP:
  ftp://ftp.kddilabs.jp/CPAN/modules/02packages.details.txt.gz
Going to read /root/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Mon, 30 Jul 2007 04:50:38 GMT
  HTTP::Date not available

  There's a new CPAN.pm version (v1.9102) available!
  [Current version is v1.7602]
  You might want to try
    install Bundle::CPAN
    reload cpan
  without quitting the current session. It should be a seamless upgrade
  while we are running...

LWP not available
Fetching with Net::FTP:
  ftp://ftp.kddilabs.jp/CPAN/modules/03modlist.data.gz
Going to read /root/.cpan/sources/modules/03modlist.data.gz
Going to write /root/.cpan/Metadata
Running install for module Module::Find
Running make for C/CR/CRENZ/Module-Find-0.05.tar.gz
LWP not available
Fetching with Net::FTP:
  ftp://ftp.kddilabs.jp/CPAN/authors/id/C/CR/CRENZ/Module-Find-0.05.tar.gz
CPAN: Digest::MD5 loaded ok
LWP not available
Fetching with Net::FTP:
  ftp://ftp.kddilabs.jp/CPAN/authors/id/C/CR/CRENZ/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/C/CR/CRENZ/Module-Find-0.05.tar.gz ok
Scanning cache /root/.cpan/build for sizes
Module-Find-0.05/
Module-Find-0.05/test/
Module-Find-0.05/test/ModuleFindTest/
Module-Find-0.05/test/ModuleFindTest/SubMod/
Module-Find-0.05/test/ModuleFindTest/SubMod/SubSubMod.pm
Module-Find-0.05/test/ModuleFindTest/SubMod.pm
Module-Find-0.05/test/README
Module-Find-0.05/test/ModuleFindTest.pm
Module-Find-0.05/t/
Module-Find-0.05/t/4-useall.t
Module-Find-0.05/t/3-usesub.t
Module-Find-0.05/t/1-use.t
Module-Find-0.05/t/5-setmoduledirs.t
Module-Find-0.05/t/2-find.t
Module-Find-0.05/t/pod-coverage.t
Module-Find-0.05/t/pod.t
Module-Find-0.05/Changes
Module-Find-0.05/MANIFEST
Module-Find-0.05/Find.pm
Module-Find-0.05/META.yml
Module-Find-0.05/README
Module-Find-0.05/Makefile.PL

  CPAN.pm: Going to build C/CR/CRENZ/Module-Find-0.05.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Module::Find
cp Find.pm blib/lib/Module/Find.pm
Manifying blib/man3/Module::Find.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/1-use..............ok                                                      
t/2-find.............ok                                                      
t/3-usesub...........ok                                                      
t/4-useall...........ok                                                      
t/5-setmoduledirs....ok                                                      
t/pod-coverage.......skipped
        all skipped: Test::Pod::Coverage 1.04 required for testing POD coverage
t/pod................skipped
        all skipped: Test::Pod 1.14 required for testing POD
All tests successful, 2 tests skipped.
Files=7, Tests=24,  3 wallclock secs ( 0.52 cusr +  1.68 csys =  2.20 CPU)
  /usr/bin/make test -- OK
Running make install
Installing /usr/lib/perl5/site_perl/5.8.8/Module/Find.pm
Installing /usr/share/man/man3/Module::Find.3pm
Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Module/Find/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
  /usr/bin/make install  -- OK
# perl -MCPAN -e "install Path::Class"
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
  Database was generated on Mon, 30 Jul 2007 04:50:38 GMT
Running install for module Path::Class
Running make for K/KW/KWILLIAMS/Path-Class-0.16.tar.gz
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
  ftp://ftp.kddilabs.jp/CPAN/authors/id/K/KW/KWILLIAMS/Path-Class-0.16.tar.gz
CPAN: Digest::MD5 loaded ok
LWP not available
Fetching with Net::FTP:
  ftp://ftp.kddilabs.jp/CPAN/authors/id/K/KW/KWILLIAMS/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/K/KW/KWILLIAMS/Path-Class-0.16.tar.gz ok
Scanning cache /root/.cpan/build for sizes
Path-Class-0.16/
Path-Class-0.16/Build.PL
Path-Class-0.16/Changes
Path-Class-0.16/INSTALL
Path-Class-0.16/lib/
Path-Class-0.16/lib/Path/
Path-Class-0.16/lib/Path/Class/
Path-Class-0.16/lib/Path/Class/Dir.pm
Path-Class-0.16/lib/Path/Class/Entity.pm
Path-Class-0.16/lib/Path/Class/File.pm
Path-Class-0.16/lib/Path/Class.pm
Path-Class-0.16/Makefile.PL
Path-Class-0.16/MANIFEST
Path-Class-0.16/META.yml
Path-Class-0.16/README
Path-Class-0.16/SIGNATURE
Path-Class-0.16/t/
Path-Class-0.16/t/01-basic.t
Path-Class-0.16/t/02-foreign.t
Path-Class-0.16/t/03-filesystem.t

  CPAN.pm: Going to build K/KW/KWILLIAMS/Path-Class-0.16.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Path::Class
cp lib/Path/Class/Entity.pm blib/lib/Path/Class/Entity.pm
cp lib/Path/Class.pm blib/lib/Path/Class.pm
cp lib/Path/Class/File.pm blib/lib/Path/Class/File.pm
cp lib/Path/Class/Dir.pm blib/lib/Path/Class/Dir.pm
Manifying blib/man3/Path::Class.3pm
Manifying blib/man3/Path::Class::Dir.3pm
Manifying blib/man3/Path::Class::File.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01-basic.........ok                                                        
t/02-foreign.......ok 1/29# Test 28 got: "dir/subdir" (t/02-foreign.t at line 68 *TODO*)
#    Expected: "/dir/subdir"
#  t/02-foreign.t line 68 is: ok $dir->as_foreign('Unix'), '/dir/subdir';
# Test 29 got: "" (t/02-foreign.t at line 69 *TODO*)
#    Expected: "1"
#  t/02-foreign.t line 69 is: ok $dir->as_foreign('Unix')->is_absolute, 1;
t/02-foreign.......ok                                                        
        2/29 skipped: Can't test VMS code on other platforms
t/03-filesystem....ok                                                        
All tests successful, 2 subtests skipped.
Files=3, Tests=158,  1 wallclock secs ( 0.35 cusr +  1.04 csys =  1.39 CPU)
  /usr/bin/make test -- OK
Running make install
Installing /usr/lib/perl5/site_perl/5.8.8/Path/Class.pm
Installing /usr/lib/perl5/site_perl/5.8.8/Path/Class/File.pm
Installing /usr/lib/perl5/site_perl/5.8.8/Path/Class/Entity.pm
Installing /usr/lib/perl5/site_perl/5.8.8/Path/Class/Dir.pm
Installing /usr/share/man/man3/Path::Class::Dir.3pm
Installing /usr/share/man/man3/Path::Class::File.3pm
Installing /usr/share/man/man3/Path::Class.3pm
Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Path/Class/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
  /usr/bin/make install  -- OK

Catalystをインストールします。

結局前日のgcc未インストールが影響して(かどうかわからないですが)、色々ともう覚えていないくらいエラーでまくり。
gccを入れてからCatalystに必要なもの - 徒委記を参考に、少しづつインストールしていきました。
なんとかうまく入ったみたい。トータルで3時間くらいかかりました。VM上のリソースの少ない環境だけど夜中作業としてつらいものがありました・・・・ww眠い。

CPANの初期設定

参考サイト
CPAN を使い Perl モジュールをインストールする|perl|@OMAKASE
2006-12-13

といってもすべてEnterで進めただけです。
最初にnoを指定すると自動設定になるようです。


gccが入っていなくてはまりましたが・・・・

# perl -MCPAN -e shell
We have to reconfigure CPAN.pm due to following uninitialized parameters:

cpan_home, keep_source_where, build_dir, build_cache, scan_cache, index_expire, gzip, tar, unzip, make, pager, makepl_arg, make_arg, make_install_arg, urllist, inhibit_startup_message, ftp_proxy, http_proxy, no_proxy, prerequisites_policy, cache_metadata

/usr/lib/perl5/5.8.8/CPAN/Config.pm initialized.



CPAN is the world-wide archive of perl resources. It consists of about
100 sites that all replicate the same contents all around the globe.
Many countries have at least one CPAN site already. The resources
found on CPAN are easily accessible with the CPAN.pm module. If you
want to use CPAN.pm, you have to configure it properly.

If you do not want to enter a dialog now, you can answer 'no' to this
question and I'll try to autoconfigure. (Note: you can revisit this
dialog anytime later by typing 'o conf init' at the cpan prompt.)

Are you ready for manual configuration? [yes] 

The following questions are intended to help you with the
configuration. The CPAN module needs a directory of its own to cache
important index files and maybe keep a temporary mirror of CPAN files.
This may be a site-wide directory or a personal directory.



I see you already have a  directory
    /root/.cpan
Shall we use it as the general CPAN build and cache directory?

CPAN build and cache directory? [/root/.cpan] 


If you want, I can keep the source files after a build in the cpan
home directory. If you choose so then future builds will take the
files from there. If you don't want to keep them, answer 0 to the
next question.



How big should the disk cache be for keeping the build directories
with all the intermediate files?

Cache size for build directory (in MB)? [10] 


By default, each time the CPAN module is started, cache scanning
is performed to keep the cache size in sync. To prevent from this,
disable the cache scanning with 'never'.

Perform cache scanning (atstart or never)? [atstart] 


To considerably speed up the initial CPAN shell startup, it is
possible to use Storable to create a cache of metadata. If Storable
is not available, the normal index mechanism will be used.

Cache metadata (yes/no)? [yes] 


The next option deals with the charset your terminal supports. In
general CPAN is English speaking territory, thus the charset does not
matter much, but some of the aliens out there who upload their
software to CPAN bear names that are outside the ASCII range. If your
terminal supports UTF-8, you say no to the next question, if it
supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it
supports neither nor, your answer does not matter, you will not be
able to read the names of some authors anyway. If you answer no, names
will be output in UTF-8.

Your terminal expects ISO-8859-1 (yes/no)? [yes] 


If you have one of the readline packages (Term::ReadLine::Perl,
Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN
shell will have history support. The next two questions deal with the
filename of the history file and with its size. If you do not want to
set this variable, please hit SPACE RETURN to the following question.

File to save your history? [/root/.cpan/histfile] 
Number of lines to save? [100] 


The CPAN module can detect when a module that which you are trying to
build depends on prerequisites. If this happens, it can build the
prerequisites for you automatically ('follow'), ask you for
confirmation ('ask'), or just ignore them ('ignore'). Please set your
policy to one of the three values.

Policy on building prerequisites (follow, ask or ignore)? [ask] 


The CPAN module will need a few external programs to work properly.
Please correct me, if I guess the wrong path for a program. Don't
panic if you do not have some of them, just press ENTER for those. To
disable the use of a download program, you can type a space followed
by ENTER.

Where is your gzip program? [/bin/gzip] 
Where is your tar program? [/bin/tar] 
Where is your unzip program? [/usr/bin/unzip] 
Where is your make program? [/usr/bin/make] 
Warning: links not found in PATH
Where is your links program? [] /bin/ln         
Where is your wget program? [/usr/bin/wget] 
Warning: ncftpget not found in PATH
Where is your ncftpget program? [] 
Warning: ncftp not found in PATH
Where is your ncftp program? [] 
Where is your ftp program? [/usr/kerberos/bin/ftp] 
Where is your gpg program? [/usr/bin/gpg] 
What is your favorite pager program? [/usr/bin/less] 
What is your favorite shell? [/bin/bash] 


Every Makefile.PL is run by perl in a separate process. Likewise we
run 'make' and 'make install' in processes. If you have any
parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass
to the calls, please specify them here.

If you don't understand this question, just press ENTER.

Parameters for the 'perl Makefile.PL' command?
Typical frequently used settings:

    PREFIX=~/perl       non-root users (please see manual for more hints)

Your choice:  [] 
Parameters for the 'make' command?
Typical frequently used setting:

    -j3              dual processor system

Your choice:  [] 
Parameters for the 'make install' command?
Typical frequently used setting:

    UNINST=1         to always uninstall potentially conflicting files

Your choice:  [] 


Sometimes you may wish to leave the processes run by CPAN alone
without caring about them. As sometimes the Makefile.PL contains
question you're expected to answer, you can set a timer that will
kill a 'perl Makefile.PL' process after the specified time in seconds.

If you set this value to 0, these processes will wait forever. This is
the default and recommended setting.

Timeout for inactivity during Makefile.PL? [0] 


If you're accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
the $CPAN::Config takes precedence.

Your ftp_proxy?  
Your http_proxy?  
Your no_proxy?  
You have no /root/.cpan/sources/MIRRORED.BY
  I'm trying to fetch one
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY


Now we need to know where your favorite CPAN sites are located. Push
a few sites onto the array (just in case the first on the array won't
work). If you are mirroring CPAN to your local workstation, specify a
file: URL.

First, pick a nearby continent and country (you can pick several of
each, separated by spaces, or none if you just want to keep your
existing selections). Then, you will be presented with a list of URLs
of CPAN mirrors in the countries you selected, along with previously
selected URLs. Select some of those URLs, or just keep the old list.
Finally, you will be prompted for any extra URLs -- file:, ftp:, or
http: -- that host a CPAN mirror.

(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 2
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) China
(2) Hong Kong
(3) Indonesia
(4) Israel
(5) Japan
(6) Malaysia
(7) Philippines
(8) Republic of Korea
(9) Russian Federation
(10) Saudi Arabia
(11) Singapore
(12) Taiwan
(13) Thailand
(14) Turkey
Select your country (or several nearby countries) [] 5
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) ftp://ftp.dti.ad.jp/pub/lang/CPAN/
(2) ftp://ftp.jaist.ac.jp/pub/lang/perl/CPAN/
(3) ftp://ftp.kddilabs.jp/CPAN/
(4) ftp://ftp.nara.wide.ad.jp/pub/CPAN/
(5) ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
(6) ftp://ftp.u-aizu.ac.jp/pub/CPAN
(7) ftp://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/
(8) http://ftp.cpan.jp/
Select as many URLs as you like (by number),
put them on one line, separated by blanks, e.g. '1 4 5' [] 3 1 2 4 5 6 7 8

Enter another URL or RETURN to quit: [] 
New set of picks:
  ftp://ftp.kddilabs.jp/CPAN/
  ftp://ftp.dti.ad.jp/pub/lang/CPAN/
  ftp://ftp.jaist.ac.jp/pub/lang/perl/CPAN/
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/
  ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
  ftp://ftp.u-aizu.ac.jp/pub/CPAN
  ftp://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/
  http://ftp.cpan.jp/


commit: wrote /usr/lib/perl5/5.8.8/CPAN/Config.pm
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')

cpan> 

SJISを使えるようにする。

参考サイト
 http://kajuhome.com/cgi-bin/patio/patio.cgi?mode=view&no=792

locale結果

# locale -a |grep ja  
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
ja_JP
ja_JP.eucjp
ja_JP.ujis
ja_JP.utf8
japanese
japanese.euc

SJIS定義を作成

# localedef -f SHIFT_JIS -i ja_JP ja_JP.SJIS
character map `SHIFT_JIS' is not ASCII compatible, locale not ISO C compliant

# locale -a |grep ja
ja_JP
ja_JP.eucjp
ja_JP.sjis
ja_JP.ujis
ja_JP.utf8
japanese
japanese.euc

locale
LANG=ja_JP.SJIS
LC_CTYPE="ja_JP.SJIS"
LC_NUMERIC="ja_JP.SJIS"
LC_TIME="ja_JP.SJIS"
LC_COLLATE="ja_JP.SJIS"
LC_MONETARY="ja_JP.SJIS"
LC_MESSAGES="ja_JP.SJIS"
LC_PAPER="ja_JP.SJIS"
LC_NAME="ja_JP.SJIS"
LC_ADDRESS="ja_JP.SJIS"
LC_TELEPHONE="ja_JP.SJIS"
LC_MEASUREMENT="ja_JP.SJIS"
LC_IDENTIFICATION="ja_JP.SJIS"
LC_ALL=

i18nを設定

LANG="ja_JP.SJIS"
SUPPORTED="ja_JP.UTF-8:ja_JP:ja"
SYSFONT="latarcyrheb-sun16"

結果

# locale
LANG=ja_JP.SJIS
LC_CTYPE="ja_JP.SJIS"
LC_NUMERIC="ja_JP.SJIS"
LC_TIME="ja_JP.SJIS"
LC_COLLATE="ja_JP.SJIS"
LC_MONETARY="ja_JP.SJIS"
LC_MESSAGES="ja_JP.SJIS"
LC_PAPER="ja_JP.SJIS"
LC_NAME="ja_JP.SJIS"
LC_ADDRESS="ja_JP.SJIS"
LC_TELEPHONE="ja_JP.SJIS"
LC_MEASUREMENT="ja_JP.SJIS"
LC_IDENTIFICATION="ja_JP.SJIS"
LC_ALL=

# echo $LANG
ja_JP.SJIS


以上