Re: Defacto standard string library



richard@xxxxxxxxxxxxxxx (Richard Tobin) writes:
In article <ANN7l.14634$Sp5.13522@xxxxxxxxxxxxxxxxxxxxxxxxx>,
Bartc <bartc@xxxxxxxxxx> wrote:

strcmp() will only work on UTF-8 if you make use of the result as either 0
or not 0.

No, it will give Unicode ordering.

And if you use strcmp() on mixed UTF-8 and ordinary strings, then
the result might be meaningless (a string containing a single encoded
Unicode Character could match a string of several ordinary chars).

If you use strcmp() between strings in different encodings of course
the result is likely to be meaningless. However UTF-8 has the advantage
that it can be compared against ascii, since ascii is a subset of UTF-8.

How does "\xEF\xBB\xBF\x40" compare against "\x41" using strcmp()?

Phil
--
I tried the Vista speech recognition by running the tutorial. I was
amazed, it was awesome, recognised every word I said. Then I said the
wrong word ... and it typed the right one. It was actually just
detecting a sound and printing the expected word! -- pbhj on /.
.



Relevant Pages

  • Re: Defacto standard string library
    ... it will give Unicode ordering. ... Unicode Character could match a string of several ordinary chars). ... the result is likely to be meaningless. ... that it can be compared against ascii, since ascii is a subset of UTF-8. ...
    (comp.lang.c)
  • Re: opening a file
    ... If used as a string rather than a number, ... yields the current value of the C "errno" ... might be meaningless. ... ref Returns a non-empty string if EXPR is a reference, ...
    (comp.lang.perl.misc)
  • Re: Defacto standard string library
    ... Unicode Character could match a string of several ordinary chars). ... the result is likely to be meaningless. ... that it can be compared against ascii, since ascii is a subset of UTF-8. ...
    (comp.lang.c)
  • Re: STL Slow - VS2005
    ... tests and only glanced at the test scenario, ... The first and most crucial question to ask of any benchmark is how ... it can still be entirely meaningless (if the ... People have done quite a few studies on string lengths as they're ...
    (microsoft.public.vc.stl)
  • Re: STL Slow - VS2005
    ... I do have to see we are having trouble finding any test scenario that runs ... The first and most crucial question to ask of any benchmark is how ... it can still be entirely meaningless (if the ... People have done quite a few studies on string lengths as they're ...
    (microsoft.public.vc.stl)