From: Sune A. <sun...@ho...> - 2005-12-16 18:28:46
|
Hi Vladimir, thanks for helping out. This is how I do it (reading an environment variable and comparing it to a value) at the moment: 1) Create default converter converter = ucnv_open( NULL, &error ); 2) Convert char* setenv() to Unicode in UChar variable 'trace' ucnv_toUChars( converter...., trace 3) Create a string to compare with u_charsToUChars( "value", value, 6); 4) Compare the values u_strCaseCompare( trace, 3, value, -1, U_FOLD_CASE_DEFAULT.... I'm new to ICU and Unicode so it's quite a challenge for me at the moment. - Does the above make sense at all? - Where can I look for good-practice implementation (on a tutorial kind of level, just to let you off the hook you know ;) A good way to learn I think... - When should I NOT use U_FOLD_CASE_DEFAULT in the string comparison above? - Are invariants part of all codepages? fopen is supposed to fail of characters outside the codepage is used, what happens if I add a suffix such as .xml to a file when the codepage used is, for example BIG5?? Can I fopen it again if the user types his filename including such a suffix? Thanks again, sorry to keep bothering you /Sune >From: Vladimir Weinstein <wei...@gm...> >Reply-To: icu...@li... >To: icu...@li... >Subject: Re: [icu-design] Apply ICU to properly manage command line >arguments in C? >Date: Fri, 16 Dec 2005 08:08:43 -0800 > >Hi Sune, > >the arguments would be in whatever 8-bit codepage the platform is >using. Generally, if a file is specified on a command line, you should >be able to open it using the argument. If, on the other hand, you need >to read and process Unicode contents from command line, you can either >convert from the platform codepage to Unicode or use invariant >characters combined with \u notation, which would give you the regular >Unicode range. > >Hope this helps. > >Regards, >v. > >On 12/15/05, Sune Ahlgren <sun...@ho...> wrote: > > Hi, > > > > on what format are command line arguments received in the main( int >argc, > > char** argv) function? > > For example I write a program that opens and prints the contents of a >file: > > > > program <filename> > > > > What approach should I use in ICU properly receive the filename and open >the > > correct file? Are there any pit falls I need to know of? > > > > BRs > > /Sune > > > > _________________________________________________________________ > > Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/ > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log >files > > for problems? Stop! Download the new AJAX search engine that makes > > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > > _______________________________________________ > > icu-design mailing list > > icu...@li... > > To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-design > > > > >-- >Vladimir Weinstein, IBM GCoC-Unicode/ICU San Jose, CA > > >------------------------------------------------------- >This SF.net email is sponsored by: Splunk Inc. Do you grep through log >files >for problems? Stop! Download the new AJAX search engine that makes >searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >http://ads.osdn.com/?ad_idv37&alloc_id865&op=click >_______________________________________________ >icu-design mailing list >icu...@li... >To Un/Subscribe: https://lists.sourceforge.net/lists/listinfo/icu-design _________________________________________________________________ Hitta rätt på nätet med MSN Search http://search.msn.se/ |