remove extra line from unixcharset.properties put the real implementation of nsUNIXCharset.cpp

This commit is contained in:
ftang%netscape.com 1999-05-05 23:51:15 +00:00
parent 513dfaf93d
commit df1408625c
2 changed files with 33 additions and 2 deletions

View File

@ -17,9 +17,11 @@
* Netscape Communications Corporation. All Rights Reserved. * Netscape Communications Corporation. All Rights Reserved.
*/ */
#include <locale.h>
#include "nsIPlatformCharset.h" #include "nsIPlatformCharset.h"
#include "nsPlatformCharsetFactory.h" #include "nsPlatformCharsetFactory.h"
#include "pratom.h" #include "pratom.h"
#include "nsURLProperties.h"
#include "nsUConvDll.h" #include "nsUConvDll.h"
@ -36,6 +38,8 @@ public:
NS_IMETHOD GetCharset(nsPlatformCharsetSel selector, nsString& oResult); NS_IMETHOD GetCharset(nsPlatformCharsetSel selector, nsString& oResult);
private:
nsString mCharset;
}; };
NS_IMPL_ISUPPORTS(nsUNIXCharset, kIPlatformCharsetIID); NS_IMPL_ISUPPORTS(nsUNIXCharset, kIPlatformCharsetIID);
@ -44,6 +48,34 @@ nsUNIXCharset::nsUNIXCharset()
{ {
NS_INIT_REFCNT(); NS_INIT_REFCNT();
PR_AtomicIncrement(&g_InstanceCount); PR_AtomicIncrement(&g_InstanceCount);
char* locale = setlocale(LC_ALL, "");
if(locale)
{
nsAutoString propertyURL("resource://res/unixcharset.properties");
nsURLProperties *info = new nsURLProperties( propertyURL );
if( info )
{
nsAutoString platformLocaleKey("locale." OSTYPE ".");
platformLocaleKey.Append(locale);
nsresult res = info->Get(platformLocaleKey, mCharset);
if(NS_FAILED(res)) {
nsAutoString localeKey("locale.");
localeKey.Append(locale);
nsresult res = info->Get(localeKey, mCharset);
if(NS_SUCCEEDED(res)) {
delete info;
return; // succeeded
}
}
delete info;
}
}
mCharset = "ISO-8859-1";
return; // failed
} }
nsUNIXCharset::~nsUNIXCharset() nsUNIXCharset::~nsUNIXCharset()
{ {
@ -53,7 +85,7 @@ nsUNIXCharset::~nsUNIXCharset()
NS_IMETHODIMP NS_IMETHODIMP
nsUNIXCharset::GetCharset(nsPlatformCharsetSel selector, nsString& oResult) nsUNIXCharset::GetCharset(nsPlatformCharsetSel selector, nsString& oResult)
{ {
oResult = "ISO-8859-1"; // XXX- hack to be implement oResult = mCharset;
return NS_OK; return NS_OK;
} }

View File

@ -146,7 +146,6 @@ locale.all.ja_JP.SJIS=Shift_JIS
locale.all.ja_JP.IBM-eucJP=EUC-JP locale.all.ja_JP.IBM-eucJP=EUC-JP
locale.all.ja_JP.mscode=Shift_JIS locale.all.ja_JP.mscode=Shift_JIS
locale.all.ja_JP.ujis=EUC-JP locale.all.ja_JP.ujis=EUC-JP
locale.all.japanese=EUC-JP
locale.all.katakana=Shift_JIS locale.all.katakana=Shift_JIS
locale.all.ko=EUC-KR locale.all.ko=EUC-KR
locale.all.ko_KR=EUC-KR locale.all.ko_KR=EUC-KR