[FX.php List] Checking POST data for content.

DC dan.cynosure at dbmscan.com
Fri Mar 17 09:50:34 MST 2006


sorry to hear your problem wasn't solved by that clever decode code i found.

you could try a javascript test on each field to see if the field had 
been edited if you want to keep things client side before submit. 
javascript probably has it's own issues with encoding.

sorry i couldn't help further since i don't really work with aring, 
aelig or oslashes!

good luck.
dan

Rob H. Christensen had written:
> Hi Dan, 
> 
> Thanks for your reply. I have been around the html_entity_decode(), but it
> did not do what I wanted.
> There are scandinavian letters in the text, which do not seem to be
> influenced as I would like it. I will give your code a try.
> 
> My pages are encoded as ISO-8859-1, but somehow when FX brings the text into
> the FileMaker database and then gets it back, I get problems with the aring,
> aelig and oslash characters. Exactly what goes wrong, I am not sure.
> Some of the input text fields  my script sees as changed, and then generates
> the variable for the log, even though the text field has not been touched,
> and the text still is the one placed in there by FX. This is specially true
> when the Scandinavian characters are in the field or in the pop-up (and even
> when they are not selected).
> Since in 90 percent of the cases the data will be edited whenever they are
> displayed, all the editable data comes in form fields ready to be edited.
> It is in the compare of data brought by FX into the form with data after
> submit, that a log is been made of all the changed data.  I do this by
> comparing the "old" data taken from the database before editing with the
> data in the POST array, which should be the same, if the data has not been
> edited. That is, unless something happens with that data while it is put
> into the array, and sent to the next page.
> 
> There were some entries on encoding in Gjermund's homepage
> fxdialog.comitas.no, which got hacked somewhere around Christmas and I am
> sorry I can not check on them any more. Gjermund is Norwegian and they use
> the same characters. He had some stuff there, which helped me before.
> 
> I still am looking for a good method to handle these characters.
> 
> The second part of my question was: Is there a better way to check if a
> field in a form has been edited, then to compare with a repeated query after
> submit, but before the changes are fed to the database?
> 
> Rob
> 
> "Just dabbling with databases and PHP to fill whatever spare time there is
> left... Why watch television?"
> 
> 
>>Hi Rob,
>>
>>I think i undersatnd what you are asking... you have to make sure you
>>are comparing the same data.
>>
>>Take a look at the manual page for html_entity_decode().
>>
>>http://us2.php.net/manual/en/function.html-entity-decode.php
>>
>>where i found this code comment:
>>---------------------------------
>>This function seems to have to have two limitations (at least in PHP 4.3.8):
>>
>>a) it does not work with multibyte character codings, such as UTF-8
>>b) it does not decode numeric entity references
>>
>>a) can be solved by using iconv to convert to ISO-8859-1, then decoding
>>the entities, than convert to UTF-8 again. But that's quite ugly and
>>detroys all characters not present in Latin-1.
>>
>>b) can be solved rather nicely using the following code:
>>
>><?php
>>function decode_entities($text) {
>>    $text= html_entity_decode($text,ENT_QUOTES,"ISO-8859-1"); #NOTE:
>>UTF-8 does not work!
>>    $text= preg_replace('/&#(\d+);/me',"chr(\\1)",$text); #decimal notation
>>    $text= preg_replace('/&#x([a-f0-9]+);/mei',"chr(0x\\1)",$text);
>>#hex notation
>>    return $text;
>>}
>>?>
>>
>>HTH
>>---------------------------------
>>
>>mvh,
>>dan
> 
> 
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 


More information about the FX.php_List mailing list