Changed most instances of wxString::FromAscii to fromUTF8, which is generally more correct (may fix Issue 460, please confirm).

Rationale: FromAscii should only be used on old-style DOS/ANSI character strings that use the upper 128 characters for drawing pictures or writing umlauts, which is pretty much nothing at all as far as PCSX2 is concerned.  Chances are even the japanese console logs coming from the PS2 itself use UTF8. 

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2092 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-10-29 13:51:49 +00:00
parent 7d458d583c
commit 0a4745863c
11 changed files with 23 additions and 20 deletions

View File

@ -13,7 +13,10 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <wx/filename.h>
#include "StringHelpers.h"
#define g_MaxPath 255 // 255 is safer with antiquated Win32 ASCII APIs.
@ -29,7 +32,7 @@ public:
wxDirName() : wxFileName() {}
wxDirName( const wxDirName& src ) : wxFileName( src ) { }
explicit wxDirName( const char* src ) { Assign( wxString::FromAscii(src) ); }
explicit wxDirName( const char* src ) { Assign( fromUTF8(src) ); }
explicit wxDirName( const wxString& src ) { Assign( src ); }
// ------------------------------------------------------------------------
@ -93,7 +96,7 @@ public:
wxDirName& operator=(const wxDirName& dirname) { Assign( dirname ); return *this; }
wxDirName& operator=(const wxString& dirname) { Assign( dirname ); return *this; }
wxDirName& operator=(const char* dirname) { Assign( wxString::FromAscii(dirname) ); return *this; }
wxDirName& operator=(const char* dirname) { Assign( fromUTF8(dirname) ); return *this; }
wxFileName operator+( const wxFileName& right ) const { return Combine( right ); }
wxDirName operator+( const wxDirName& right ) const { return Combine( right ); }

View File

@ -19,12 +19,12 @@
wxString GetEnglish( const char* msg )
{
return wxString::FromAscii(msg);
return fromUTF8(msg);
}
wxString GetTranslation( const char* msg )
{
return wxGetTranslation( wxString::FromAscii(msg).c_str() );
return wxGetTranslation( fromUTF8(msg) );
}
// ------------------------------------------------------------------------

View File

@ -85,7 +85,7 @@ T Parse( const wxString& src, const wxString& separators=L",")
{
T retval;
if( !TryParse( retval, src, separators ) )
throw Exception::ParseError( "Parse failure on call to " + wxString::FromAscii(__WXFUNCTION__) + ": " + src );
throw Exception::ParseError( "Parse failure on call to " + fromUTF8(__WXFUNCTION__) + ": " + src );
return retval;
}

View File

@ -105,7 +105,7 @@ void Win32::RealVersionInfo::InitVersionString()
int majorVersion = (DWORD)(LOBYTE(LOWORD(version)));
int minorVersion = (DWORD)(HIBYTE(LOWORD(version)));
wxString verName( wxString::FromAscii( GetVersionName( minorVersion, majorVersion ) ) );
wxString verName( fromUTF8( GetVersionName( minorVersion, majorVersion ) ) );
bool IsCompatMode = false;

View File

@ -29,11 +29,11 @@ void *_openfile(const char *filename, int flags)
{
int _flags = CREATE_NEW;
if (flags & O_CREAT) _flags = CREATE_ALWAYS;
handle = CreateFile(wxString::FromAscii(filename).c_str(), GENERIC_WRITE, 0, NULL, _flags, 0, NULL);
handle = CreateFile(fromUTF8(filename), GENERIC_WRITE, 0, NULL, _flags, 0, NULL);
}
else
{
handle = CreateFile(wxString::FromAscii(filename).c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
handle = CreateFile(fromUTF8(filename), GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
}
return (handle == INVALID_HANDLE_VALUE) ? NULL : handle;

View File

@ -521,7 +521,7 @@ u32 loadElfCRC( const char* filename )
if ( IsoFS_findFile( filename + mylen, &toc ) == -1 ) return 0;
DevCon.WriteLn( "loadElfFile: %d bytes", toc.fileSize );
u32 crcval = ElfObject( wxString::FromAscii( filename ), toc.fileSize ).GetCRC();
u32 crcval = ElfObject( fromUTF8( filename ), toc.fileSize ).GetCRC();
Console.WriteLn( "loadElfFile: %s; CRC = %8.8X", filename, crcval );
return crcval;
@ -655,7 +655,7 @@ int GetPS2ElfName( wxString& name )
// the filename is everything up to the first CR/LF/tab.. ?
// Or up to any whitespace? (I'm opting for first CRLF/tab, although the old code
// apparently stopped on spaces too) --air
name = wxStringTokenizer( wxString::FromAscii( pos ) ).GetNextToken();
name = wxStringTokenizer( fromUTF8( pos ) ).GetNextToken();
#ifdef PCSX2_DEVBUILD
FILE *fp;

View File

@ -88,7 +88,7 @@ void SaveStateBase::FreezeTag( const char* src )
pxFail( "Savestate data corruption detected while reading tag" );
throw Exception::BadSavedState(
// Untranslated diagnostic msg (use default msg for translation)
L"Savestate data corruption detected while reading tag: " + wxString::FromAscii(src)
L"Savestate data corruption detected while reading tag: " + fromUTF8(src)
);
}
}

View File

@ -117,7 +117,7 @@ public:
bool Test( int pluginTypeIndex ) const
{
// all test functions use the same parameterless API, so just pick one arbitrarily (I pick PAD!)
PluginTestFnptr testfunc = (PluginTestFnptr)m_plugin.GetSymbol( wxString::FromAscii( tbl_PluginInfo[pluginTypeIndex].shortname ) + L"test" );
PluginTestFnptr testfunc = (PluginTestFnptr)m_plugin.GetSymbol( fromUTF8( tbl_PluginInfo[pluginTypeIndex].shortname ) + L"test" );
if( testfunc == NULL ) return false;
return (testfunc() == 0);
}
@ -125,7 +125,7 @@ public:
wxString GetName() const
{
pxAssert( m_GetLibName != NULL );
return wxString::FromAscii(m_GetLibName());
return fromUTF8(m_GetLibName());
}
void GetVersionString( wxString& dest, int pluginTypeIndex ) const

View File

@ -182,7 +182,7 @@ namespace wxHelpers
void Launch(const char *filename)
{
Launch( wxString::FromAscii(filename) );
Launch( fromUTF8(filename) );
}
// ------------------------------------------------------------------------
@ -198,7 +198,7 @@ namespace wxHelpers
void Explore(const char *path)
{
Explore( wxString::FromAscii(path) );
Explore( fromUTF8(path) );
}
}

View File

@ -226,10 +226,10 @@ bool IsBIOS(const wxString& filename, wxString& description)
case 'C': zone = "China"; break;
}
const wxString romver( wxString::FromAscii(aROMVER) );
const wxString romver( fromUTF8(aROMVER) );
description.Printf( L"%-7s v%c%c.%c%c(%c%c/%c%c/%c%c%c%c) %s",
wxString::FromAscii(zone).c_str(),
fromUTF8(zone).c_str(),
romver[0], romver[1], // ver major
romver[2], romver[3], // ver minor
romver[12], romver[13], // day

View File

@ -124,7 +124,7 @@ void ProfilerRegisterSource(const char* Name, const void* buff, u32 sz)
if( ProfRunning )
EnterCriticalSection( &ProfModulesLock );
wxString strName( wxString::FromAscii(Name) );
wxString strName( fromUTF8(Name) );
if( !_registeredName( strName ) )
ProfModules.push_back( Module( strName, buff, sz ) );
@ -137,7 +137,7 @@ void ProfilerRegisterSource(const char* Name, const void* function)
if( ProfRunning )
EnterCriticalSection( &ProfModulesLock );
wxString strName( wxString::FromAscii(Name) );
wxString strName( fromUTF8(Name) );
if( !_registeredName( strName ) )
ProfModules.push_back( Module(strName,function) );
@ -147,7 +147,7 @@ void ProfilerRegisterSource(const char* Name, const void* function)
void ProfilerTerminateSource( const char* Name )
{
wxString strName( wxString::FromAscii(Name) );
wxString strName( fromUTF8(Name) );
for( vector<Module>::const_iterator
iter = ProfModules.begin(),
end = ProfModules.end(); iter<end; ++iter )