Forum: NGINX nginx memcached module and strange characters

Posted by Laurent Thevenet (Guest)
on 2008-03-13 23:27
(Received via mailing list)
Hi,

When retrieving data via the mecached module, there is some strange
characters appearing. It looks like that kind of encoding issue
between utf8 and iso8859-1.
Data is encoded by a rails app (via a mongrel cluster).
Is there any encoding parameters on the nginx side i have not seen or
is it more propably memcached which is not supporting utf8 ?

Thx
Posted by Nanyang Zhan (xain)
on 2008-07-25 09:34
I notice the same problem.
nginx version: nginx/0.5.34

any solution?
Posted by Nanyang Zhan (xain)
on 2008-07-30 11:07
I have tried nginx/0.6.32, but this didn't fix the problem.
I used:
ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-linux] and
ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-darwin9]
with
memcached 1.2.5
libmemcached 0.22
memcached gem 0.11
or
memcached-client 1.5.0

here is my nginx conf file:
worker_processes  1;
pid        /www/logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    server {
        listen       80;
        server_name  localhost;
        location / {
          default_type text/html;
          set $memcached_key $uri;
          memcached_pass localhost:11211;
        }
    }
}

after I setup a cache:
irb(main):002:0> require 'memcached'
=> true
irb(main):003:0> c = Memcached.new('localhost:11211')
#...
irb(main):006:0> c.set '/test', 'hello'

when I opened 127.0.0.1/test with safari 3.0 or Firefox 3, I got:
"hello

I get no idea where the Quotation mark coming from!!!!! Can anyone tell 
me how to fix it?
Posted by Nanyang Zhan (xain)
on 2008-07-31 06:38
The problem is solved.
By default marshal values are cached. Just cache raw content, there will 
be no quotation mark.
Posted by Travis Bell (travisbell)
on 2009-02-09 11:33
Nanyang Zhan wrote:
> The problem is solved.
> By default marshal values are cached. Just cache raw content, there will 
> be no quotation mark.

Hey Nanyang,

Could you explain in lamens terms what that means? I am running into 
this issue and not sure why or how to fix it.

Posted by Travis Bell (travisbell)
on 2009-02-09 12:10
Travis Bell wrote:
> Nanyang Zhan wrote:
>> The problem is solved.
>> By default marshal values are cached. Just cache raw content, there will 
>> be no quotation mark.
> 
> Hey Nanyang,
> 
> Could you explain in lamens terms what that means? I am running into 
> this issue and not sure why or how to fix it.

Nevermind! The following set command is what anyone having this problem 
is after (if you're using memcached):

set (key, value, ttl=nil, marshal=true, flags=FLAGS)
Posted by Travis Bell (travisbell)
on 2009-02-09 12:11
Travis Bell wrote:
> Travis Bell wrote:
>> Nanyang Zhan wrote:
>>> The problem is solved.
>>> By default marshal values are cached. Just cache raw content, there will 
>>> be no quotation mark.
>> 
>> Hey Nanyang,
>> 
>> Could you explain in lamens terms what that means? I am running into 
>> this issue and not sure why or how to fix it.
> 
> Nevermind! The following set command is what anyone having this problem 
> is after (if you're using memcached):
> 

Haha... oi, it's getting late. marshal needs to be set to FALSE...

set (key, value, ttl=nil, marshal=false, flags=FLAGS)
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.