Which encoding is best?

External developers... This forum's for you!

Which encoding is best?

Postby Dave_Higgins » Fri Sep 10, 2010 10:06 pm

In digging around sample source code, when it comes to various encodings (usually when converting strings/data/pointers/handles/etc... into strings) I see sometimes a MacRoman encoding is being used, and sometimes a UTF-8 encoding being used (for functions/methods that require an encoding).

For the most part, when working with English, it seems that the two are pretty much interchangeable, so long as the strings are alphanumeric.

However, when it comes to writing externals, I don't know what might happen when they're being used on systems that are not English based. I know Mark has been working on incorporating UTF-8 and others as much as possible in various places within SC, so when it comes to things like object/card/bg/window/project names and userProp names/data being handed back and forth between SC and externals, is there one encoding that would be better off to use over the others?

I know that in certain circumstances a different particular encoding will be required, but hopefully that should be obvious in any documentation covering such cases. I'm just thinking in general terms of moving text around that will end up in fields or as object names... That sort of thing.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Which encoding is best?

Postby codegreen » Sat Sep 11, 2010 7:55 am

Dave Higgins wrote:In digging around sample source code, when it comes to various encodings (usually when converting strings/data/pointers/handles/etc... into strings) I see sometimes a MacRoman encoding is being used, and sometimes a UTF-8 encoding being used (for functions/methods that require an encoding).

For the most part, when working with English, it seems that the two are pretty much interchangeable, so long as the strings are alphanumeric.

Only for the lower 128 chars...

However, when it comes to writing externals, I don't know what might happen when they're being used on systems that are not English based. I know Mark has been working on incorporating UTF-8 and others as much as possible in various places within SC, so when it comes to things like object/card/bg/window/project names and userProp names/data being handed back and forth between SC and externals, is there one encoding that would be better off to use over the others?

I know that in certain circumstances a different particular encoding will be required, but hopefully that should be obvious in any documentation covering such cases. I'm just thinking in general terms of moving text around that will end up in fields or as object names... That sort of thing.

SC still uses MacRoman internally for script and object names, so if you want your code to work reliably you should too.

-Mark
codegreen
 
Posts: 1510
Joined: Mon Jul 14, 2008 11:03 pm


Return to Xcode and the Internals Toolbox

Who is online

Users browsing this forum: No registered users and 1 guest

cron