ANSI file is used to be recognized like UTF

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Post Reply
vovabigov
Posts: 3
Joined: Thu Aug 14, 2008 11:40 am

ANSI file is used to be recognized like UTF

Post by vovabigov »

I have one big PHP file with a lot of php-code and comments in russian (cirylic) language. During opening WeBuilder recognizes this file like UTF* (I see it on the bottom tab of main program window). While I save this file, I choose ANSI encoding. So, when I open it again, I see again UTF*. This is bad for me, becouse I need this file in ANSI for my project.

This happens only with one file, other similar files used to be opened and saved in ANSI well. So, I suppose that there is some "bad" piece of code in this file, am I right?

Can anyone tell me what I must look for, please?


WinXP
WeBuilder 9.0.0.97
Cary
Posts: 82
Joined: Mon May 28, 2007 10:41 pm

Re: ANSI file is used to be recognized like UTF

Post by Cary »

Sounds like you have the following in the head of your HTML:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

WeBuilder will see this and rightly assume the page should be using utf-8 encoding. You're not using utf-8, so this information is wrong.

Instead of charset=utf-8, there are alternatives for Cyrillic you can try:

charset=iso-8859-5
charset=windows-1251
charset=koi8-r
charset=koi8-ru

Edit:
Oops, I forgot this was a php file. You may well be able to drop the meta tag altogether.
Last edited by Cary on Sun Aug 17, 2008 3:28 am, edited 2 times in total.
vovabigov
Posts: 3
Joined: Thu Aug 14, 2008 11:40 am

Re: ANSI file is used to be recognized like UTF

Post by vovabigov »

Cary wrote:Sounds like you have the following in the head of your HTML:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
No! I have
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Re: ANSI file is used to be recognized like UTF

Post by Karlis »

Are you sure there is no combination if characters that matches an UTF-8 character? Even if there is only one UTF-8 character, the file will be treated as UTF-8.

Anyways, why not use UTF-8 in the first place? Everybody is moving to UTF-8 nowadays.
Karlis Blumentals
Blumentals Software
www.blumentals.net
vovabigov
Posts: 3
Joined: Thu Aug 14, 2008 11:40 am

Re: ANSI file is used to be recognized like UTF

Post by vovabigov »

Thanx for help! I found out the problem.

I had string like this in my script:

if ($_SESSION['lang'] =='ru') {
echo "<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>";
} else {
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>";
}

So, WeBuilder didn't see meta-tag and interpreted it like he wants :)


UTF is good, but in Russia there are many hosting-servers, which makes it's using difficult. Sometimes it is much easy to set windows-1251' in script rather than set up server, DB, scripts, etc ;)
Post Reply