Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

267
Visualizações
PHP/Ajax Unserialize to JSON

I have an issue where I’m doing this with AJAX

$('form').serialize()

I than convert it or "Unserialize" it with PHP using:

$params = array();
parse_str($_POST['data'], $params);
echo $params['name'];

I then use json_encode($params); and save to a file.

My issue is, when I use a character like ’ or - for example, it serialises it to \u2019 or \u2010 which I don't want, I want it stored as ’ or ‐ in JSON. I've tried absolutely everything to convert it.

I assume my point of conversion is on $params['name'] before being saved to JSON, I tried flags like JSON_UNESCAPED_UNICODE but this isn't it either. I don't have iconv or mb_ libraries to convert using those.

I believe the \u2019 is Unicode? and I need it converted to an HTML entity and then saved to JSON as an HTML entity.

I know this is very bizarre, but it’s for a very specific reason, and I’ve spent about 5 hours now on Google and I’m depleted.

I’ve come to the conclusion there is no native PHP function that’ll do it, but is there a function someone has written available? or do I need to get iconv or mb?

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda