INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Unicode text sorting using Locale  (Read 2168 times)

jam

  • Regular Member
  • World Citizen
  • ***
  • Posts: 125
  • nothing more to say...
Unicode text sorting using Locale
« on: September 11, 2003, 06:55:46 pm »

Hi,

I was saying MC9.1 had not been using locale information for text (artist/title/etc) sorting.  However, Matt was saying MC9.1 had been using it.  I thought there are some problems in Windows library, so I was working to make small test programs.  I tested Windows sorting functions for Unicode text using my program.  Results are:
  • wcscoll function never uses locale info
  • CompareString(LOCALE_USER_DEFAULT, ...) function uses user locale info, but I'm using English as my user default locale.
  • CompareString(LOCALE_SYSTEM_DEFAULT, ...) functions uses system default locale info and sorted correctly!!  ;D

Now, I understand MC9.1 is using LOCALE_USER_DEFAULT when it sorts text.  Mmmmm.

A user default locale is used to specify all information, not only text but also number, currency, time, date, etc.  I really want to keep those information in English.  On the other hand, a system default locale is used for unknown text that was not solved by user locale.  I just want to use Windows in English and treat unknown text as Japanese, so I was using Windows with Japanese SYSTEM default locale.  This configuration was making the sorting problem in MC9.1.

Is it possible to give us an option to specify which locale is used for text sorting?  I really want to keep my user locale in English.  Or maybe little bit intelligent sorting like check both system and user locale and if one is English, use the other...  Thanks.

Anyway, for the record, this sorting problem was not a bug of MC9.1.  ;)
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: Unicode text sorting using Locale
« Reply #1 on: September 11, 2003, 07:05:58 pm »

Hmm...

If we always used the system default would it cause problems?  It made more sense to use the user default, but maybe that's not necessary.

Let us know.

(and I think the gotcha with wscoll is that you need to call setlocale before using it)
Logged
Matt Ashland, JRiver Media Center

jam

  • Regular Member
  • World Citizen
  • ***
  • Posts: 125
  • nothing more to say...
Re: Unicode text sorting using Locale
« Reply #2 on: September 11, 2003, 07:19:55 pm »

Quote
If we always used the system default would it cause problems?

I think it causes problems.  For example, if a user was not administrator of a computer, he/she cannot change system default locale.  Another example, maybe another user prefer specifying only user locale to specifying system locale.

Current implementation in Windows is something like this.  It checks user locale first, then try system locale if first try is failed.  For the case of text conversion, this works fine.  But for any other operation, Windows uses only user locale since for example, sorting in English never fails.  I wish if Windows sorting routine fails when it finds non English text and uses system locale for sorting... ;)

Quote
(and I think the gotcha with wscoll is that you need to call setlocale before using it)

I see.  I didn't have a time to try it.  BTW, I wish if Windows had a LANG environment variable to specify locale...
Logged

simpleuser99

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 76
  • BANZAI!!!!
Re: Unicode text sorting using Locale
« Reply #3 on: September 11, 2003, 10:29:39 pm »

Jam,
 Do you use Japanese Characters? How to they sort?
 Also, is everything at the bottom sorted wrong?

Also, does anyone else know, maybe I haven't tried it, how to add special tree listings. For Example:

+ Playing Now
+ Media Library
   + Audio
   + Images
   + Video
   + Advanced

and also have

+ Playing Now
+ Media Library
   + Audio
   + Images
   + Video
   + Advanced
   + Japanese Songs
      + Artist
      + File
      + Disk location
   + Korean Songs
   + Chinese Songs

Etc., Etc.

Thanks.
Logged

jam

  • Regular Member
  • World Citizen
  • ***
  • Posts: 125
  • nothing more to say...
Re: Unicode text sorting using Locale
« Reply #4 on: September 12, 2003, 12:29:32 pm »

Quote
Do you use Japanese Characters? How to they sort?  Also, is everything at the bottom sorted wrong?

Yes, I'm using Japanese characters.  MC9.1 sorts them automatically even if I didn't specify Japanese as my user locale.  However, the result is not correctly sorted in Japanese sense.  To fix this, I need to specify Japanese as my user locale.  And, all Japanese characters will be sorted after the alphabets.  However, those Japanese should be sorted in language specific order among Japanese characters.

For example, let's think about three wide characters in Unicode, "4e2d", "4eba", and "5c0f", these must be sorted as "5c0f", "4eba", and "4e2d" in Japanese.  Howver, if I use English locale, those are sorted as "4e2d", "4eba", and "5c0f" since English local just compare short values.  On the other hand, there may be a locale it sorts as "4eba", "4e2d", "5c0f".  Order of characters is a part of culture.  Unicode is just simple uni-subscribing code.  It doesn't contain any information about culture, so it is impossible to sort Unicode for everyone.

Quote

Also, does anyone else know, maybe I haven't tried it, how to add special tree listings. For Example:

+ Playing Now
+ Media Library
   + Audio
   + Images
   + Video
   + Advanced
   + Japanese Songs
      + Artist
      + File
      + Disk location
   + Korean Songs
   + Chinese Songs

I don't know how to make personal group view like your "Japanese Songs" group in Media Library view.  What I know is how to make "Japanese Songs - Artist" single layer view scheme.  For example, if all Japanese songs are placed in a "Japanese" folder, just specify"[Media Type]=[Audio] Filename=\Japanese\" in the files property of this view scheme.  You can use any information that MC9.1 smartlist allows us to specify songs.  I really like this feature and smartlist.  ;D
Logged

simpleuser99

  • Regular Member
  • Junior Woodchuck
  • **
  • Posts: 76
  • BANZAI!!!!
Re: Unicode text sorting using Locale
« Reply #5 on: September 12, 2003, 09:42:19 pm »

NARUHODO!!!

Actually, I tyied adding this view scheme for the first time.
I never realized how useful MC9 is with all these things.

I was ale to add the folder I wanted - almost like adding a folder to Outlook Folder List.

I realize that I can really add what I want to Media Center.
WMP 9 is sickening limited with such design features.

WOW, good job JRiver.
Thank you for the advice Jam.
Logged
Pages: [1]   Go Up