LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-26-2012, 06:51 AM   #1
Velotrol
LQ Newbie
 
Registered: Apr 2011
Location: Rio, Brazil
Distribution: Gentoo
Posts: 15

Rep: Reputation: Disabled
Strange characters on nginx


Hi all,
I'm struggling with this issue for days. I have a server with nginx and php on Gentoo, and some international characters are not showing correctly. Here's my nginx.conf:

Code:
user nginx nginx;
worker_processes 1;

error_log /var/log/nginx/error_log info;

events {
	worker_connections 1024;
	use epoll;
}

http {
	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	log_format main
		'$remote_addr - $remote_user [$time_local] '
		'"$request" $status $bytes_sent '
		'"$http_referer" "$http_user_agent" '
		'"$gzip_ratio"';

	client_header_timeout 10m;
	client_body_timeout 10m;
	send_timeout 10m;

	connection_pool_size 256;
	client_header_buffer_size 1k;
	large_client_header_buffers 4 2k;
	request_pool_size 4k;

	gzip on;
	gzip_min_length 1100;
	gzip_buffers 4 8k;
	gzip_types text/plain;
	gzip_disable "MSIE [1-6]\.(?!.*SV1)";

	output_buffers 1 32k;
	postpone_output 1460;

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;

	keepalive_timeout 75 20;

	ignore_invalid_headers on;

	index index.html index.php;

	server {
		listen 80;
		server_name www.server.br;

		access_log /var/log/nginx/workflow.access_log main;
		error_log /var/log/nginx/workflow.error_log info;

		root /var/www/modulo;

		location ~ \.php$ {
		       include /etc/nginx/fastcgi_params;
		       fastcgi_pass unix:/var/run/php-fpm.socket;
		       fastcgi_index index.php;
		       fastcgi_param  SCRIPT_FILENAME /var/www/modulo$fastcgi_script_name;
		}

		location "/anexos" {
                        autoindex on;
                }
	}
}
And when I load the page by browser, international characters do not appear correctly.
http://img204.imageshack.us/img204/8673/72609040.png

Also, I already have tried to check the page header, and it seems correct (the meta information on php pages are all iso-8859-1).

Code:
$ curl -I http://192.168.20.220/paginas/Lista_Grid.php
HTTP/1.1 200 OK
Server: nginx/1.2.1
Date: Mon, 26 Nov 2012 12:13:00 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Keep-Alive: timeout=20
X-Powered-By: PHP/5.4.6--pl0-gentoo
Set-Cookie: PHPSESSID=mer339creb1b4eiur8j9o3hki7; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
I have tried to change charset in pages and in nginx.conf to utf-8, without success. And here's the output of "export" command.

Code:
piacenza ~ # cat export.txt 
declare -x CONFIG_PROTECT_MASK="/etc/gentoo-release /etc/sandbox.d /etc/php/cli-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/terminfo /etc/ca-certificates.conf /etc/revdep-rebuild"
declare -x EDITOR="/usr/bin/vi"
declare -x GCC_SPECS=""
declare -x HOME="/root"
declare -x HUSHLOGIN="FALSE"
declare -x INFOPATH="/usr/share/info:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.4/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.22/info"
declare -x LANG="pt_BR.ISO-8859-1"
declare -x LC_COLLATE="C"
declare -x LC_CTYPE="pt_BR.ISO-8859-1"
declare -x LESS="-R -M --shift 5"
declare -x LESSOPEN="|lesspipe %s"
declare -x LOGNAME="root"
declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.pdf=00;32:*.ps=00;32:*.txt=00;32:*.patch=00;32:*.diff=00;32:*.log=00;32:*.tex=00;32:*.doc=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:"
declare -x MAIL="/var/mail/root"
declare -x MANPATH="/usr/local/share/man:/usr/share/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.4/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.22/man:/usr/lib64/php5.4/man/"
declare -x MULTIOSDIRS="../lib64:../lib32"
declare -x OLDPWD
declare -x PAGER="/usr/bin/less"
declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.4"
declare -x PWD="/root"
declare -x PYTHONPATH="/usr/lib/portage/pym"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x TERM="linux"
declare -x USER="root"
Additional info:
/etc/locale.gen
Code:
pt_BR ISO-8859-1
pt_BR.UTF-8 UTF-8
en_US ISO-8859-1
en_US.UTF-8 UTF-8
/etc/env.d/02locale
Code:
LANG="pt_BR.ISO-8859-1"
LC_CTYPE="pt_BR.ISO-8859-1"
LC_COLLATE="C"
Also, when someone uploads through the php application a file containing international characters, he's not able anymore to download it from /anexos, since it appears that the server is encoding the link in a different charset.

Appreciate any help, thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange nginx redirects without trailing slash bzzik Linux - Server 11 02-27-2012 08:38 AM
Strange characters in man pages _maco_ Linux - General 2 06-01-2009 05:44 PM
Strange characters in command line in X Vitalie Ciubotaru Linux From Scratch 5 11-30-2006 06:53 PM
strange characters while loggin in through ssh legolin Linux - Networking 3 08-14-2004 02:39 AM
Strange Characters : RedHat 8.0 UberPhreek Linux - Newbie 1 10-18-2002 05:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration