The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
php code cause characters to display as garbish - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: php code cause characters to display as garbish (/showthread.php?tid=12) |
php code cause characters to display as garbish - yettyn - Feb 26th, 2009 I don't know if this is directly FT2 related, but when I put the advised php code below at start of the page, all my special swedish chars on the page turn in to "dingbat" type symbols, same as if I set page character set to use UTF-8, but page is set to use ISO 8859-1 Code: <?php If I remove the php code, page display normally showing swedish chars correctly. Any one have any idea why and what to do? Is it ok to post this in FT1 forum as well, if no one knows, as trafic here still are limited? RE: php code cause characters to display as garbish - Ben - Feb 26th, 2009 That's strange... this is probably due to UTF-8 headers being set in the API. Try opening up the api.php file and comment out line 389 in the ft_api_init_form_page() function: header("Content-Type: text/html; charset=utf-8"); Let me know if that fixes it. [By the way, if you're reading the API-form tutorials I apologize. They're not too clear! I'm going to re-write the multi-page one today.] RE: php code cause characters to display as garbish - yettyn - Feb 26th, 2009 Yes that fixed it! I am not sure yet though if it will affect anything else related to FT2. I would love to have my pages set to use UFT-8 but if I do it trashes all chars outside of the ANSI 0-127 range which is pretty odd and I don't know why. This was a major problem for a while as my mysql db is utf-8 but I couldn't get it to save chars outside of 0-127 range using ISO-8859-1 or other none utf-8 set, and utf-8 screwed the html page display. The solution is to use ISO-8859-1 (or other set specific to page language) for the page and then inside the form tag add Code: accept-charset="UTF-8" Might be usefull to know for others having same problem. [haven't had time to read all the docs yet, but do as I go... ;-)] RE: php code cause characters to display as garbish - yettyn - Mar 3rd, 2009 (Feb 26th, 2009, 11:41 AM)admin Wrote: That's strange... this is probably due to UTF-8 headers being set in the API. Try opening up the api.php file and comment out line 389 in the ft_api_init_form_page() function: Noted that line now changed to Code: header("Content-Type: text/html; charset=$g_api_header_charset"); Commenting out the line fixes it but I guess I shouldn't have to do that each tme I update, so where is that var set? I cannot find it in admin anywhere? RE: php code cause characters to display as garbish - Ben - Mar 3rd, 2009 Sorry, yettn. My bad. You're one of the very few people that would have been affected by this change. :-) That variable is stored in your library.php as the default UTF-8 value. But to override it, just add the following line to your /global/config.php file: PHP Code: $g_api_header_charset = "iso-8559-1"; After this is done, any future upgrades won't overwrite your change. RE: php code cause characters to display as garbish - yettyn - Mar 3rd, 2009 Yes of course, I found it in library.php but didn't have space left in my little brain to think of config.php ;-) All well. |