Encoding in VS2015

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

Encoding in VS2015

Postby Makla » September 3rd, 2015, 11:47 am

Hi!
I have problem with file encoding in Visual studio 2015.
All my files are saved with UTF-8 without BOM.
But PHP editor opens them in windows-1250 (encoding for my country).

How can I force editor to open all files with UTF-8? Is there any settings?
Makla
 
Posts: 4
Joined: January 18th, 2015, 11:27 am

Re: Encoding in VS2015

Postby Miloslav Beno » September 3rd, 2015, 1:52 pm

Hello,

Thank you for your post.

Visual Studio editor has option for detecting UTF-8 without signature. If there is some UTF-8 character present VS will recognize that and open the file in UTF8, if not it will use default OS encoding.

auto detect utf8.png


PHP Tools has other options regarding UTF-8. You can:
- Force UTF-8 without signature for all the document which will be opened.
- Remove signature if it's present
- Keep current encoding of the document (default)

utf8 options.png


Give me know this information helped.

Thanks,
You do not have the required permissions to view the files attached to this post.
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: Encoding in VS2015

Postby Makla » September 4th, 2015, 12:17 pm

It looks like your first idea solved my problem.
Thanks a lot. I change to VS 2015 and almost lost my mind.
Makla
 
Posts: 4
Joined: January 18th, 2015, 11:27 am

Re: Encoding in VS2015

Postby davidbcn » September 4th, 2015, 5:00 pm

This is a harsh for everyone and PHP Tools should make it easy.

You simply cannot have files with BOM used as PHP scripts, and using special characters in ANSI encoded files (which seems to be some sort of default) will yield encoding issues (so you need to convert them to UTF8 without BOM).

Maybe PHP Tools can check both conditions when saving a PHP File and if any of them are broken, prompt the user to fix the encoding issue.

Or PHP Tools can report this situation as some sort of error and tell the user which files will sure lead to encoding problems.

I cannot browse file-by-file all PHP scripts to check encoding and contents :(
davidbcn
 
Posts: 87
Joined: September 10th, 2014, 3:07 am

Re: Encoding in VS2015

Postby kurshinov » February 18th, 2016, 10:21 am

I create a new php file and it in windows-1251.
How to make sure that the file was created in the utf 8?
kurshinov
 
Posts: 3
Joined: February 11th, 2016, 7:02 am

Re: Encoding in VS2015

Postby Miloslav Beno » February 19th, 2016, 3:11 pm

Hello,

You can force saving the file in UTF8 without BOM by setting the option from PHP Tools which is explained here http://support.devsense.com/posting.php?mode=reply&f=21&t=1620#pr7423

Thanks,
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 108 guests

cron

User Control Panel

Login

Who is online

In total there are 108 users online :: 0 registered, 0 hidden and 108 guests (based on users active over the past 5 minutes)
Most users ever online was 440 on April 26th, 2024, 12:59 am

Users browsing this forum: No registered users and 108 guests