Welcome Guest, Not a member yet? Register   Sign In
Accent and form_submit
#1

Hi

First at all, I must say that I am a newbie with Code Igniter, so may be the answer is very simple for you. If I have miss a page in this forum or the documentation, please let me know, I will read it with pleasure... my current search were unsucessful.

I try to write my first code in CI and have some problem with french accent.

echo form_label('Email é : ', 'emailCreateInput');   ----> display correctly the string

echo form_submit('submit', htmlentities("Créer son compte"));   ---> the button value is empty (<input type="submit" name="submit" value=""  />)

echo form_submit('submit', htmlentities("Cr&eacute;er son compte"));   ---> the button value is "Cr&amp;eacute;er" instead of "Cr&eacute;er"   (<input type="submit" name="submit" value="Cr&amp;eacute;er son compte"  />)

I probably miss something, but do not know what.
Can you help me ?
Thanks
Reply
#2

Hi

Ok I have more information :
- form_submit calls _parse_form_attributes,
- _parse_form_attributes calls html_escape
- html_escape calls htmlspecialchars
- htmlspecialchars converts &eacute; to &amp;eacute; which leads to the behavior

May be a bug, and should call htmlentities or something like that...

I hope it helps
Reply
#3

You don't need to call htmlentities in Codeigniters own functions. It's UTF-8 safe already.

echo form_submit('submit', "Créer son compte");
Reply
#4

Hi

Thanks, but I already tested this way :
echo form_submit('submit', 'Créer son compte'); ---> <input type="submit" name="submit" value=""  />

Inside CI, it uses _attributes_to_string sometimes, but form_submit uses html_escape...

Have a nice day
Reply
#5

You will need to save all your php files as UTF-8.

In Notepad++:
Encoding -> Convert to UTF-8.
Reply
#6

I am currently using Scite and had search to set it to UTF8... after few re-work on the files it works !

Thank you so much !
Reply




Theme © iAndrew 2016 - Forum software by © MyBB