Oolite Bulletins

For information and discussion about Oolite.
It is currently Thu Aug 17, 2017 11:21 pm

All times are UTC




Post new topic  Reply to topic  [ 10 posts ] 
Author Message
PostPosted: Sun Feb 26, 2012 12:26 pm 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Thu Dec 14, 2006 9:08 am
Posts: 9520
Location: a Hacker Outpost in a moderately remote area
What is the recommended/compulsory/correct UTF coding for JS scripts in Oolite?

Additional question: where do I find out how a script is coded and how do I change it?

I am using special characters in strings which are used by the game. They are correctly displayed on my computer, both in the JS script and in-game. However, when Disembodied downloaded and opened the script, "ü" was displayed as "√º", "ë" was displayed as "√´", "é" was displayed as "√©", and "ï" was displayed as "√Ø" on his computer. We don't know yet how this affects the in-game display.

As we both are using a Mac, I am wondering what causes this incorrect display of special characters. As a long-suffering German Mac user I am used to incorrect conversion of Umlauts from Windows to Mac and vice versa, but between two Macs? Thus I'm wondering whether the UTF coding may have something to do with it.

_________________
The Story — The Career — The OXPs


Top
   
PostPosted: Sun Feb 26, 2012 1:01 pm 
Offline
Commodore
Commodore
User avatar

Joined: Fri Feb 25, 2011 8:46 am
Posts: 1127
Location: UK South Coast.
I've just looked through a variety of scripts and windows Notepad++ reports most of them as encoded in ANSI. Some of your are in UTF-8 without BOM.

_________________
[EliteWiki] Capt. Murphy's OXPs
External JavaScript resources - W3Schools & Mozilla Developer Network
Win 7 64bit, Intel Core i5 with HD3000 (driver rev. 8.15.10.2696 - March 2012), Oolite 1.76.1


Top
   
PostPosted: Sun Feb 26, 2012 1:42 pm 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Quote:
As we both are using a Mac, I am wondering what causes this incorrect display of special characters. As a long-suffering German Mac user I am used to incorrect conversion of Umlauts from Windows to Mac and vice versa, but between two Macs? Thus I'm wondering whether the UTF coding may have something to do with it.
I have no definite answer. When I look in Xcode than 'unicode (UTF-8)' is the default coding. When I look at the individual files that is also true.

But than when I open those same files with 'Texteditor' and do a 'save as...' the default coding for saving is "western (mac OS roman)". When I save them explicit with 'Texteditor' as 'unicode (UTF-8)', the default coding for saving becomes 'unicode (UTF-8)'. So I have no idea what the coding difference it between saving by Xcode or texteditor.

Self I always use "Dashcode" for editing my JS scripts. That program is part of the developer package that is on your mac installation disk, when you not already have installed it. It has an explicit option to save as a JS file. Although I can't see what coding that exactly is.

On very rare occasions I have JS files that have an unknown coding according dascode and it refuses to read them in. In that case I use texteditor to re-saving it, after which it does load.

Anyhow, try dashcode for your JS work. It even indexes all defined functions in the script in the top bar for fast finding and accessing them.

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Sun Feb 26, 2012 1:48 pm 
Offline
Intergalactic Spam Assassin
Intergalactic Spam Assassin
User avatar

Joined: Thu Dec 14, 2006 9:08 am
Posts: 9520
Location: a Hacker Outpost in a moderately remote area
I am using Dashcode. The strange conversion happens when Disembodied opens the file with TextEdit.

_________________
The Story — The Career — The OXPs


Top
   
PostPosted: Sun Feb 26, 2012 2:47 pm 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
The files are correctly encoded in UTF-8. TextEdit’s “automatic” encoding is too stupid to automatically detect UTF-8 (which is a bug; doing it is easy and very reliable). Using File→Open and selecting UTF-8 from the pop-up menu at the bottom should fix it.

_________________
E-mail: jens@oolite.org


Top
   
PostPosted: Sun Feb 26, 2012 7:51 pm 
Offline
Jedi Spam Assassin
Jedi Spam Assassin
User avatar

Joined: Thu Jul 12, 2007 10:54 pm
Posts: 5795
Location: Carter's Snort
I get the same dodgy characters when opening the files with SubEthaEdit, too ... the default setting for opening files there is called "recommended by mode". Switching to UTF-8 in SubEthaEdit displays the correct characters though.

_________________
Oofiction: Calliope: a Captain Hesperus adventure | Stranglehold: a Captain Hesperus adventure | Local Midnight in the Vacuum Bar | A Farewell to Arms, Legs, etc.: the Blaze O'Glory Story


Top
   
PostPosted: Mon Feb 27, 2012 9:11 am 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Quote:
The strange conversion happens when Disembodied opens the file with TextEdit.
TextEdit may have bugs, but looking at this, I noticed it had a preference to use smart quotes. I activated this, and it was the first mac program I ever saw that does it right in the Dutch version. In the Netherlands the starting and ending quote are identical. An upside down quote is not part of the Dutch language, but still all dutch versions of software with a smart quote option start with an “ quote. Bad localisation in my opinion. However you do see this wrong quotation more often now in some newspapers, probably because writers don't correct their word processor.

Just out of curiosity I switched my system to english and restarted TextEdit. In english it also quotes in the Dutch way. So it is not better than other programs in this, but just does it accidentally right for the Dutch language.

NB from the quoting in above two messages I should conclude that Ahruman is not Dutch and Disembodied is :)

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Mon Feb 27, 2012 9:58 am 
Offline
Jedi Spam Assassin
Jedi Spam Assassin
User avatar

Joined: Thu Jul 12, 2007 10:54 pm
Posts: 5795
Location: Carter's Snort
Quote:
NB from the quoting in above two messages I should conclude that Ahruman is not Dutch and Disembodied is :)
Not quite, although I plan to inflict some Amsterdamage on myself in the next week or so ... non-smart quotes would seem to be the default on Safari, and I can't be bothered using the keyboard shortcuts (alt-[ for “, alt-shift-[ for ”, alt-] for ‘ and alt-shift-] for ’). The biggest pain I've found with "smart quotes" (or rather, “smart quotes”) is in setting Gaelic text. It's quite common for Gaelic sentences to start ’S, which – if the author has used the apostrophe key, a “smart quoter” with a UK setting will render as ‘S ...

_________________
Oofiction: Calliope: a Captain Hesperus adventure | Stranglehold: a Captain Hesperus adventure | Local Midnight in the Vacuum Bar | A Farewell to Arms, Legs, etc.: the Blaze O'Glory Story


Top
   
PostPosted: Mon Feb 27, 2012 2:20 pm 
Offline
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
User avatar

Joined: Sat Jun 16, 2007 3:48 pm
Posts: 5536
Location: Netherlands
Quote:
Just out of curiosity I switched my system to english and restarted TextEdit. In english it also quotes in the Dutch way. So it is not better than other programs in this, but just does it accidentally right for the Dutch language.
I was completely wrong. It is not accidentally that TextEdit does it right. It is a system preference the user can edit how he wants it. You can even set the single quotes different than the double quotes or even replace them by , or <. I just forgot I once did set them. TextEdit is just the only one I've seen that respects the system preferences.

Programs like Filemaker and Pages, that I use much, ignore these system preferences. Even when both are very Mac friedly programs and Pages is part of i-works.

_________________
UPS-Courier & DeepSpacePirates & others at the box and some older versions


Top
   
PostPosted: Tue Feb 28, 2012 6:52 am 
Offline
Grand Admiral Emeritus
Grand Admiral Emeritus
User avatar

Joined: Sat Apr 02, 2005 2:43 pm
Posts: 6657
Location: Sweden
Quote:
I was completely wrong. It is not accidentally that TextEdit does it right. It is a system preference the user can edit how he wants it. You can even set the single quotes different than the double quotes or even replace them by , or <. I just forgot I once did set them. TextEdit is just the only one I've seen that respects the system preferences.
Almost every feature of TextEdit is actually a feature of NSTextView. (The source code for TextEdit is in /Developer/Examples.) You can enable system-standard smart quotes (and spelling and grammar correction, and various other things) in most text fields from the contextual menu.

_________________
E-mail: jens@oolite.org


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited