Problem Saving Text.php In UTF-8 Encoding

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
flipfloprs
Posts: 3
Joined: Sat Jan 29, 2011 12:57 pm

Problem Saving Text.php In UTF-8 Encoding

Post by flipfloprs »

Script URL:
Version of script: 2.2
Hosting company: fanaa.ir
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:
I have a problem in translating HESK to Persian language. after translation i have to save the file in UTF-8 encoding becouse the persian characters are not supported in ANSII. and after this I will have a problem in navigating between pages. for example:
1-after submiting a new ticket, user will stay in the same page and wouldn't redirected to a new page with normal message.
2-admin enters into administrator panel but after typing username and password and clicking on login button, this page will be loaded:http://support.fanaa.ir/admin/index.php
instead of this one: http://support.fanaa.ir/admin/admin_main.php

username:administrator
password:admin
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Problem Saving Text.php In UTF-8 Encoding

Post by Klemen »

The problem with saving files in UTF-8 format is that this format ads some extra bytes to the start of the file and these break the HTTP headers sent out by the script. In return some things that depend on HTTP headers (like sessions and redirects) don't work properly. Those extra bytes are not visible in most programs.

I would recommend NOT saving files in UTF-/, but if you do you can *probably* fix the problem by opening the language file in this program (Notepad++):
http://notepad-plus-plus.org/

You should see some special chars at the start of your language file, before the <?php
Deleting those chars might solve your issue.

Alternatively you should be able to see the extra UTF-8 bytes in a hex editor:
http://www.google.com/search?q=free+hesk+editor
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
flipfloprs
Posts: 3
Joined: Sat Jan 29, 2011 12:57 pm

Re: Problem Saving Text.php In UTF-8 Encoding

Post by flipfloprs »

Thanks, it worked.
flipfloprs
Posts: 3
Joined: Sat Jan 29, 2011 12:57 pm

Re: Problem Saving Text.php In UTF-8 Encoding

Post by flipfloprs »

This solution works for most of my problems but one of the major forms do not work properly yet. I have opened the language file in Notepad plus plus but their was not any additional characters so I just saved the file in UTF-8 without BOM (I have no idea what is it) and then, when I want to create a new ticket, it works but I have a speed problem. It takes more than 1 or 2 minute to show me my ticket tracking number and during this time the user can click on the submit button again and again.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Problem Saving Text.php In UTF-8 Encoding

Post by Klemen »

"bom" (byte order mark) is what is causing problems to most people saving it in UTF-8 (the bytes at the start of the file that don't show up in most editors).

If submitting a ticket takes very long it is probably due to the mail() function (your server is very slow in sending out mail) and it a server rather than a script issue. To confirm this you can delete all lines that start with

Code: Select all

@mail
from the submit_ticket.php file. It should submit a ticket quickly then, but no e-mails will be sent.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply