[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[0219] mod_encoding on FreeBSD



山崎です。

FreeBSDでmod_encodingをmakeしたのですが、組み込み後も日本語ファイルが
文字化けしてしまうので、何か情報をいただければと。

FreeBSD 4.2を使用して、libiconv-1.7を手でインストールしました。
mod_encoding-20011211aでは、

mod_encoding-20011211a/lib/Makefile

9,10c9,11
< LIBS =
< #LIBS = -liconv
---
> #LIBS =
> LIBS = -L/usr/local/lib -liconv
> INCS = -I/usr/local/include
17c18
<       $(CC) -c $(DEFS) $<
---
>       $(CC) -c $(DEFS) $(LIBS) $(INCS) $<
22c23
<       $(CC) -shared -o $@ $(OBJS) $(LIBS)
---
>       $(CC) -shared -o $@ $(OBJS) $(INCS) $(LIBS)

と変更しgmake

gcc -Wall -c -DHAS_ICONV -L/usr/local/lib -liconv -I/usr/local/include iconv_hook.c
gcc: -liconv: linker input file unused since linking not done
gcc -Wall -c -DHAS_ICONV -L/usr/local/lib -liconv -I/usr/local/include iconv_hook_default.c
iconv_hook_default.c: In function `local_iconv':
iconv_hook_default.c:61: warning: passing arg 2 of `libiconv' from incompatible pointer type
iconv_hook_default.c: At top level:
iconv_hook.h:35: warning: `iconv_hook_module_init' defined but not used
gcc: -liconv: linker input file unused since linking not done
gcc -Wall -c -DHAS_ICONV -L/usr/local/lib -liconv -I/usr/local/include iconv_hook_ja_auto.c
iconv_hook.h:35: warning: `iconv_hook_module_init' defined but not used
gcc: -liconv: linker input file unused since linking not done
gcc -Wall -c -DHAS_ICONV -L/usr/local/lib -liconv -I/usr/local/include iconv_hook_mssjis.c
iconv_hook.h:35: warning: `iconv_hook_module_init' defined but not used
gcc: -liconv: linker input file unused since linking not done
gcc -Wall -c -DHAS_ICONV -L/usr/local/lib -liconv -I/usr/local/include identify_encoding.c
gcc: -liconv: linker input file unused since linking not done
gcc -Wall -shared -o libiconv_hook.so iconv_hook.o iconv_hook_default.o iconv_hook_ja_auto.o iconv_hook_mssjis.o identif
y_encoding.o -I/usr/local/include -L/usr/local/lib -liconv

gmake installしました。
次にmod_encoding-20011211a/Makefileを

2c2
< APXS = apxs -Wc,-Wall
---
> APXS = /usr/local/apache/bin/apxs -Wc,-Wall
4c4
< INCS =
---
> INCS = -I/usr/local/include

と変更し、gmake
/usr/local/apache/bin/apxs -Wc,-Wall -c -DMOD_ENCODING_DEBUG=1 -Diconv=iconv_hook -Diconv_open=iconv_hook_open -Diconv_c
lose=iconv_hook_close -I/usr/local/include -L/usr/local/lib -Llib -liconv_hook mod_encoding.c
gcc -funsigned-char -DUSE_EXPAT -I../lib/expat-lite -fpic -DSHARED_MODULE -I/usr/local/apache/include -Wall -I/usr/local
/include -DMOD_ENCODING_DEBUG=1 -Diconv=iconv_hook -Diconv_open=iconv_hook_open -Diconv_close=iconv_hook_close  -c mod_e
ncoding.c
In file included from mod_encoding.c:14:
/usr/local/include/iconv.h:70: warning: `iconv_open' redefined
*Initialization*:1: warning: this is the location of the previous definition
/usr/local/include/iconv.h:80: warning: `iconv' redefined
*Initialization*:1: warning: this is the location of the previous definition
/usr/local/include/iconv.h:86: warning: `iconv_close' redefined
*Initialization*:1: warning: this is the location of the previous definition
mod_encoding.c: In function `iconv_string':
mod_encoding.c:90: warning: passing arg 2 of `libiconv' from incompatible pointer type
gcc -shared -o mod_encoding.so mod_encoding.o -Wc,-Wall -L/usr/local/lib -Llib -liconv_hook

し、gmake installしました。
httpd.conf側は

LoadModule dav_module         libexec/libdav.so
LoadModule encoding_module    libexec/mod_encoding.so
<IfModule mod_encoding.c>
    EncodingEngine on
    SetServerEncoding UTF-8

    AddClientEncoding UTF-8 "Microsoft-WebDAV-MiniRedir/"
    AddClientEncoding SJIS  "Microsoft .* DAV"
    AddClientEncoding SJIS  "Microsoft .* DAV 1\.1$"
    AddClientEncoding SJIS  "xdwin9x/"
</IfModule>

となっています。

/usr/local/apache/bin/apachectl configtest
server_setup: entered
folder_setup: entered
server_setup: entered
Syntax OK

となり、
apacheのリスタート後、Win2KよりWebフォルダで日本語ファイルをアップする
もしくは新規フォルダ作成をすると、文字化けを起こしています。
apacheのエラーログには

[warn] iconv_string: conversion error

と言う出力がされています。

FreeBSDで特に話題が出ていないところを見るとすんなり使えている方が
多いような気もしているのですが・・・・・・

-- 
YAMAZAKI Kiyoaki
dev@xxxxxxxxxxxxxx
090-6214-3000