Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix the Windows build on Japanese systems. #1182

Merged
merged 1 commit into from

2 participants

@zewt

guilib/LocalizedStrings.cpp was in ISO-8859-1. MSVC only autodetects
UTF-8; if a file isn't UTF-8, it assumes it's in the ANSI codepage, which
depends on the build system. That means this file was detected correctly
on US English systems (whose encoding is very similar to 8859-1), but
incorrectly on others.

This caused the compiler to choke, since it misinterprets the non-ASCII
characters as SJIS, causing the quotes after the strings to be mojibake'd
away and giving unterminated string literal errors.

Convert this file to UTF-8, so it's autodetected in any system codepage.

This needs to be tested in other build environments. I don't expect
problems with gcc; it builds UTF-8 sources without trouble.

@zewt zewt Fix the Windows build on Japanese systems.
guilib/LocalizedStrings.cpp was in ISO-8859-1.  MSVC only autodetects
UTF-8; if a file isn't UTF-8, it assumes it's in the ANSI codepage, which
depends on the build system.  That means this file was detected correctly
on US English systems (whose encoding is very similar to 8859-1), but
incorrectly on others.

This caused the compiler to choke, since it misinterprets the non-ASCII
characters as SJIS, causing the quotes after the strings to be mojibake'd
away and giving unterminated string literal errors.

Convert this file to UTF-8, so it's autodetected in any system codepage.

This needs to be tested in other build environments.  I don't expect
problems with gcc; it builds UTF-8 sources without trouble.
5a48630
@ghost

This will break. We need those chars in iso and not utf for reasons I cannot recall right now.

@zewt

Please try to recall it. Currently, it is broken.

@ghost

I will once on something a bit more practical than my phone.

@zewt

Could this be a legacy from older versions of VC?

VC2008 (I believe) and earlier always treated source files as if they're in the ANSI codepage, so putting UTF-8 in source would cause errors in certain codepages. This might be a workaround for that. (It'd only be a partial workaround, probably for a particular user's codepage, since whether that worked or not would depend on the local codepage.) VC2010 autodetects UTF-8, which makes it easier to avoid problems.

@jmarshallnz
Owner
@zewt

The date on that supports my guess, anyway...

If you're really worried, it could just be sidestepped entirely with hex escapes, but I'd see if it's really needed first.

@jmarshallnz
Owner

@alanwww1 your comments?

@zewt

It would be nice to get this applied; it's a bit of a pain. This just looks like a workaround for old versions of VS (which I don't think XBMC even has project files for anymore).

@jmarshallnz jmarshallnz was assigned
@jmarshallnz
Owner

Nothing should break as far as I can tell, so pulling. If it breaks, at least it builds on Japanese systems, so we have more people to help fix it :)

@jmarshallnz jmarshallnz merged commit 8188e27 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 19, 2012
  1. @zewt

    Fix the Windows build on Japanese systems.

    zewt authored
    guilib/LocalizedStrings.cpp was in ISO-8859-1.  MSVC only autodetects
    UTF-8; if a file isn't UTF-8, it assumes it's in the ANSI codepage, which
    depends on the build system.  That means this file was detected correctly
    on US English systems (whose encoding is very similar to 8859-1), but
    incorrectly on others.
    
    This caused the compiler to choke, since it misinterprets the non-ASCII
    characters as SJIS, causing the quotes after the strings to be mojibake'd
    away and giving unterminated string literal errors.
    
    Convert this file to UTF-8, so it's autodetected in any system codepage.
    
    This needs to be tested in other build environments.  I don't expect
    problems with gcc; it builds UTF-8 sources without trouble.
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 25 deletions.
  1. +21 −25 xbmc/guilib/LocalizeStrings.cpp
View
46 xbmc/guilib/LocalizeStrings.cpp
@@ -203,33 +203,29 @@ bool CLocalizeStrings::Load(const CStdString& strPathName, const CStdString& str
if (bLoadFallback)
LoadStr2Mem(strPathName, SOURCE_LANGUAGE, encoding);
- CStdString encoding_thisfile = "ISO-8859-1";
- // we have ANSI encoding for LocalizeStrings.cpp therefore we need to use this encoding
- // when we add the degree strings
-
// fill in the constant strings
m_strings[20022].strTranslated = "";
- m_strings[20027].strTranslated = ToUTF8(encoding_thisfile, "°F");
- m_strings[20028].strTranslated = ToUTF8(encoding_thisfile, "K");
- m_strings[20029].strTranslated = ToUTF8(encoding_thisfile, "°C");
- m_strings[20030].strTranslated = ToUTF8(encoding_thisfile, "°Ré");
- m_strings[20031].strTranslated = ToUTF8(encoding_thisfile, "°Ra");
- m_strings[20032].strTranslated = ToUTF8(encoding_thisfile, "°Rø");
- m_strings[20033].strTranslated = ToUTF8(encoding_thisfile, "°De");
- m_strings[20034].strTranslated = ToUTF8(encoding_thisfile, "°N");
-
- m_strings[20200].strTranslated = ToUTF8(encoding_thisfile, "km/h");
- m_strings[20201].strTranslated = ToUTF8(encoding_thisfile, "m/min");
- m_strings[20202].strTranslated = ToUTF8(encoding_thisfile, "m/s");
- m_strings[20203].strTranslated = ToUTF8(encoding_thisfile, "ft/h");
- m_strings[20204].strTranslated = ToUTF8(encoding_thisfile, "ft/min");
- m_strings[20205].strTranslated = ToUTF8(encoding_thisfile, "ft/s");
- m_strings[20206].strTranslated = ToUTF8(encoding_thisfile, "mph");
- m_strings[20207].strTranslated = ToUTF8(encoding_thisfile, "kts");
- m_strings[20208].strTranslated = ToUTF8(encoding_thisfile, "Beaufort");
- m_strings[20209].strTranslated = ToUTF8(encoding_thisfile, "inch/s");
- m_strings[20210].strTranslated = ToUTF8(encoding_thisfile, "yard/s");
- m_strings[20211].strTranslated = ToUTF8(encoding_thisfile, "Furlong/Fortnight");
+ m_strings[20027].strTranslated = "°F";
+ m_strings[20028].strTranslated = "K";
+ m_strings[20029].strTranslated = "°C";
+ m_strings[20030].strTranslated = "°Ré";
+ m_strings[20031].strTranslated = "°Ra";
+ m_strings[20032].strTranslated = "°Rø";
+ m_strings[20033].strTranslated = "°De";
+ m_strings[20034].strTranslated = "°N";
+
+ m_strings[20200].strTranslated = "km/h";
+ m_strings[20201].strTranslated = "m/min";
+ m_strings[20202].strTranslated = "m/s";
+ m_strings[20203].strTranslated = "ft/h";
+ m_strings[20204].strTranslated = "ft/min";
+ m_strings[20205].strTranslated = "ft/s";
+ m_strings[20206].strTranslated = "mph";
+ m_strings[20207].strTranslated = "kts";
+ m_strings[20208].strTranslated = "Beaufort";
+ m_strings[20209].strTranslated = "inch/s";
+ m_strings[20210].strTranslated = "yard/s";
+ m_strings[20211].strTranslated = "Furlong/Fortnight";
return true;
}
Something went wrong with that request. Please try again.