0
votes

One of the files in my project contains German Umlaut characters, But these do not display when I bring the file up in WebStorm. Instead, I get black diamonds with a question mark in the middle which would seem to indicate that the character in question is not understood.

I found another thread here on stackoverflow.com which explained how to set file encodings inside WebStorm both for the current project and as the default for all projects. That's pretty easy to do. You just go to File --> Settings --> File Encodings for the one and File --> Default Settings --> File Encodings for the other.

When I go to those pages in my WebStorm app, I see settings for 'IDE Encoding' and 'Project Encoding'. Both are set for UTF-8. Yet these characters are not showing up when I view the file inside WebStorm and are clearly not being understood as such in the program itself, either. (I'm using them inside regular expressions which fail because the umlauted characters are not understood.)

When I open the same file inside Ultra Edit, another text editing program I use outside of WebStorm, the characters display as they should, indicating that the accented characters really are there in the file.

Any idea why WebStorm is not recognizing these characters?

2
Did you check the actual encoding of your file? - mistapink
1) What kind of file is that (html/js/etc)? 2) What encoding WebStorm is using for that file? (you can see it in status bar when that file is opened in Editor) 3) If IDE still picks wrong encoding, you can override it in that settings screen -- just find your file in a tree there and manually assign specific encoding 4) Any chance of sharing such file (actual file, not just copy-pasted content)? - LazyOne
Hi. It's a .js file. I have a Meteor method stored in a .js file called convertToLate.js which is in my Server file along with some others. Down at the bottom of the page in the status bar, the file is marked as UTF8. I checked the other open files, as welll, and they all show up as UTF8 except that for one of the HTML files it still reads UTF-8 but is grayed out. I went to change manually and got a message saying I could either reload or convert. I tried both. Neither worked. I get an odd message saying it will change the content of the file. It seems to think my UTF-8 is not valid. - Darwood Horace
So .. can you share such file somewhere? It would be good to download it as is (unchanged) and see what another tool/editor thinks about it. 2) HTML -- you cannot change encoding of some files if they have standard charset attribute (standard stuff in <head> section). 3) You need to use "Reload" and not "Convert" -- first just reads file using different encoding while second actually changes encoding of certain (affected) characters and can damage your file if done incorrectly (e.g. original encoding was wrong etc). P.S. Please use @username if you want that person to be notified - LazyOne
Thanks, @LazyOne, for your assistance. Based on your info, I decided to try to open the file in Notepad and re-save it as UTF-8. That made it so the German characters display correctly inside WebStorm now. So I have to guess UltraEdit (whose iffy Unicode functionality has tripped me up before) just doesn't save files in a way that's compatible with WebStorm. --- However, now Meteor doesn't seem to be able to read the file. So I guess I'm not quite yet done solving this problem. If you have any ideas, please let me know. And thanks very much for your assistance in resolving the other issue. - Darwood Horace

2 Answers

0
votes

OK, I believe I have figured this out. If I save the UTF-8 file with a BOM, WebStorm can display the Unicode characters contained in the file, but Meteor cannot run the file. ---

However, if I save the UTF-8 file without a BOM, WebStorm cannot display the Unicode characters contained in the file but Meteor can run the file. However, Meteor ignores the non-ASCII characters because it apparently can't decipher them. --

So I have to conclude that WS and Meteor are not compatible with each other in terms of how they handle non-ASCII text. But maybe there's a way around it?

0
votes

I did two things:

1- I upgraded to the stable version of Meteor 1.3 (which was just released within the past few hours it appears)
2- I had to manually edit my UTF8 .js file directly within WebStorm since it would no longer display the proper characters in either Notepad or UltraEdit. ---

That worked. I now have the Unicode characters displaying in WebStorm and running correctly in Meteor.

I'm not sure I understand why it is now working, but I'm glad it is. Thanks to @LazyOne for helping me to know where to even start with fixing this. –