English 中文(简体)
燃料价格表 实地值将一些特性转换为超文本实体
原标题:FuelPHP form field value converts some character into HTML entities

我在燃料法中有奇怪的行为。 我用燃料价格表生成地面:投入(投入)方法。 问题是,有些特性被转换为超文本实体。 例如,s已转换成š。 实地生成形式守则见以下,产出可视图见(第一个产出只是直线的html案文)。

<?php echo $user->profile_fields[ firstname ]; ?> 
<?php echo Form::input( firstname , Input::post( firstname , isset($user->profile_fields[ firstname ]) ? $user->profile_fields[ firstname ] :   )); ?> 

enter image description here

最糟糕的是,只有在从<条码>引人瞩目_fields读取价值的形式领域才发生。 DB field inuser table ($user->profile_fields [ firstname ]). <代码>Profile_fields is standard MySQL text field inuser table used by briefAutheur. 这个领域拥有序列化钥匙=>对用户信息(如第一名称、最后名称、地址等)进行估价。 如果我读到非航空领域在非航空领域的价值一样,并创建具有这种价值的表格场,那么就会适当展示。

I use utf8_unicode_cicolation and encoding in my DB set up, 燃料PHP locale and encoding is also set appropriate to UTF-8

UPDATE1: take a look at this:

//values read from MySQL DB, via FuelPHP orm, unserialized
echo $user->profile_fields[ firstname ] .     . $user->profile_fields[ lastname ];
echo  <br> ;

//same values serialized and assigned to PHP array var
$test = serialize(array( firstname => Urška ,  lastname => Neumüller ));
var_dump($test);

echo  <br> ;
$test2 = unserialize($test);
var_dump($test2);

echo  <br> ;
echo  <input type="text" value=" .$test2[ firstname ]. "> ;
echo  <input type="text" value=" .$test2[ lastname ]. "> ;

echo  <br> ;
echo  <input type="text" value=" .htmlspecialchars($test2[ firstname ]). "> ;
echo  <input type="text" value=" .htmlspecialchars($test2[ lastname ]). "> ;

echo  <br> ;
echo  <input type="text" value=" .$user->profile_fields[ firstname ]. "> ;
echo  <input type="text" value=" .$user->profile_fields[ lastname ]. "> ;

echo  <br> ;
echo  <input type="text" value=" .htmlspecialchars($user->profile_fields[ firstname ]). "> ;
echo  <input type="text" value=" .htmlspecialchars($user->profile_fields[ lastname ]). "> ;

此处使用的原因是,燃料价格指数表格在形成形式领域时使用,是某些特性被转换为超文本实体的原因。

output:

“entergraph

这一问题是否存在于亚洲开发银行、公共卫生和公共卫生部、燃料价格调查。 我在这里被完全丧失!

最佳回答

你必须非常清楚地了解你正在做的事情。

燃料价格指数按输出代码表示,即你提交意见的所有数据都将编码为html。 在这种情况下,从控制员到控制方的用户将编码。

你的2美元试验阵列是建立INSIDE的,因此不会编码。

现在,当你使用表格中的用户价值:投入(投入)时,价值将预先确定(如Franco正确地提到),该数值将再次编码。 举例来说,“&amp”将改为“&amp;amp”,并导致你描述的行为。 如你的例子所示,如果你以人工方式从用户处输入价值。

因此:

  • pass the variable to the view without encoding (might be dangerous!)
  • disable prepping as Frank described
  • upgrade to the latest 1.1/develop branch, which has double encoding disabled by default
问题回答

由于安全原因,通常在产出上编码特殊性。 如果您确定格式将第<条码>_prep_ Value 至<条码>fal 或向投入领域提供<代码>>dont_prep” =>真实。





相关问题
Mojarra for JSF Encoding

Can anyone teach me how to use mojarra to encode my JSF files. I downloaded mojarra and expected some kind of jar but what i had downloaded was a folder of files i don t know what to do with

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Using Java PDFBox library to write Russian PDF

I am using a Java library called PDFBox trying to write text to a PDF. It works perfect for English text, but when i tried to write Russian text inside the PDF the letters appeared so strange. It ...

what is encoding in Ajax?

Generally we are using UTF-8 encoding standard for sending the request for every language. But in some language this encoding standard is not working properly,then in that case we are using ISO-8859-1....

Encoding of window.location.hash

Does window.location.hash contain the encoded or decoded representation of the url part? When I open the same url (http://localhost/something/#%C3%BC where %C3%BCtranslates to ü) in Firefox 3.5 and ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

热门标签