How can you determine if your app is running on a double-byte system?

Running on a double-byte system would mean you have to be careful with some things.

But how can you determine if your app is running on a double-byte system?

Any ideas?

Thanks

Markus

Hi Marcus.

As long as you are using Unicode then the majority of things should just work.

If you are using declares then make sure you use the W (wide) APIs on MS-Windows.

Is there anything you are particularly concerned about?

RegEx

From the Xojo documentation:

Double-byte Systems

If you are working with a double-byte system such as Japanese, RegEx cannot operate on the characters directly. You should first convert all double-byte text to UTF8 using the built-in Text Converter functions. See, for example, the TextConverter class for an example of how to use the Text Converter functions.

All text that will be processed by RegEx should be converted. This includes SearchPattern, ReplacementPattern, and TargetString. The result of the Search or Search and Replace will be a UTF8 string, so you will need to convert it back to its original form using the Text Converter functions. Both Search and Search and Replace operations work on all platforms, provided that this conversion takes place.

This seems like it should say “double byte encodings” but …

Take the string you have and convert it to UTF8

   if s.encoding is Encodings.UTF8 then
       // do nothing
   elseif s.encoding is nil then
        // not sure what you'd want to do in this case
   else
         s = s.convertEncoding(Encodings.UTF8)
   end if

   // now do your regex business

Thanks Norman!