{"action":"created","issue":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch-perl/issues/57","labels_url":"https://api.github.com/repos/elasticsearch/elasticsearch-perl/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/elasticsearch/elasticsearch-perl/issues/57/comments","events_url":"https://api.github.com/repos/elasticsearch/elasticsearch-perl/issues/57/events","html_url":"https://github.com/elasticsearch/elasticsearch-perl/issues/57","id":55859707,"number":57,"title":"UTF8 - Nightmare","user":{"login":"celogeek","id":65178,"avatar_url":"https://avatars.githubusercontent.com/u/65178?v=3","gravatar_id":"","url":"https://api.github.com/users/celogeek","html_url":"https://github.com/celogeek","followers_url":"https://api.github.com/users/celogeek/followers","following_url":"https://api.github.com/users/celogeek/following{/other_user}","gists_url":"https://api.github.com/users/celogeek/gists{/gist_id}","starred_url":"https://api.github.com/users/celogeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/celogeek/subscriptions","organizations_url":"https://api.github.com/users/celogeek/orgs","repos_url":"https://api.github.com/users/celogeek/repos","events_url":"https://api.github.com/users/celogeek/events{/privacy}","received_events_url":"https://api.github.com/users/celogeek/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-29T05:56:27Z","updated_at":"2015-01-29T09:29:03Z","closed_at":null,"body":"Hi,\r\n\r\nI'm trying to use Search::Elasticsearch with utf8 text.\r\n\r\n```\r\nperl -MDDP -Mutf8 -MSearch::Elasticsearch -E 'my $els = Search::Elasticsearch->new(serializer => \"JSON::XS\"); my $d = $els->index(qw(index test type test id test body), { test => \"héhé\" }); say p($d)'\r\n```\r\n\r\nWhen I check the token, I've got properly the word \"héhé\" searchable. So storing is perfect.\r\n\r\nWhen I want to retrieve the \"test\", it return \"héhé\" but in latin1 ! : h<E9>h<E9>\r\n\r\n```\r\nperl -MDDP -Mutf8 -MSearch::Elasticsearch -E 'my $els = Search::Elasticsearch->new(serializer => \"JSON::XS\"); my $d = $els->get(qw(index test type test id test)); say p($d)' \r\n```\r\n\r\nHow can I properly set utf8 content to elasticsearch, and retrieve it in the exact same way I have put it ?\r\n\r\nIt is a problem with the serializer ?"},"comment":{"url":"https://api.github.com/repos/elasticsearch/elasticsearch-perl/issues/comments/71993981","html_url":"https://github.com/elasticsearch/elasticsearch-perl/issues/57#issuecomment-71993981","issue_url":"https://api.github.com/repos/elasticsearch/elasticsearch-perl/issues/57","id":71993981,"user":{"login":"celogeek","id":65178,"avatar_url":"https://avatars.githubusercontent.com/u/65178?v=3","gravatar_id":"","url":"https://api.github.com/users/celogeek","html_url":"https://github.com/celogeek","followers_url":"https://api.github.com/users/celogeek/followers","following_url":"https://api.github.com/users/celogeek/following{/other_user}","gists_url":"https://api.github.com/users/celogeek/gists{/gist_id}","starred_url":"https://api.github.com/users/celogeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/celogeek/subscriptions","organizations_url":"https://api.github.com/users/celogeek/orgs","repos_url":"https://api.github.com/users/celogeek/repos","events_url":"https://api.github.com/users/celogeek/events{/privacy}","received_events_url":"https://api.github.com/users/celogeek/received_events","type":"User","site_admin":false},"created_at":"2015-01-29T09:29:03Z","updated_at":"2015-01-29T09:29:03Z","body":"Oh,\r\n\r\nI have solve my problem !\r\n\r\nI read my file using the \"raw\". The file contain \"utf8\" string.\r\n\r\nSo when I encode for ElasticSearch, I need to ask JSON to not encode my string.\r\nWhen I retrieve the information from ElasticSearch, I want the utf8 version, also here I ask to not decode again.\r\n\r\nSo I have create a serializer like this :\r\n\r\n```\r\npackage Search::Elasticsearch::Serializer::CGJSON;\r\nuse Moo;\r\nuse JSON::MaybeXS 1.002002 ();\r\n \r\nhas 'JSON' => ( is => 'ro', default => sub { JSON::MaybeXS->new } );\r\n \r\nwith 'Search::Elasticsearch::Role::Serializer::JSON';\r\nuse namespace::clean;\r\n \r\n1;\r\n```\r\n\r\nAnd now I put and get utf8 string properly."}}