List:Internals« Previous MessageNext Message »
From:Paul DuBois Date:October 18 2002 5:54pm
Subject:Re: Question about CONVERT(str,charset_to,charset_from)
View as plain text  
At 21:49 +0400 10/18/02, Peter Zaitsev wrote:
>On Friday 18 October 2002 21:39, you wrote:
>>  At 21:29 +0400 10/18/02, Peter Zaitsev wrote:
>>  >On Friday 18 October 2002 20:20, Paul DuBois wrote:
>>  >>  I've been puzzling over this patch, which implements a form of the
>>  >>  CONVERT() function.  I can see that this can be useful for specifying
>>  >>  the destination character set as a string expression rather than as
>>  >>  an unquoted character set name.  But I'm wondering why the second
>argument
>>  >>  is necessary at all.  Strings have a charset already, why do you have
>>  >>  to specify what it is?
>>  >>
>>  >
>>  >You do not have charset for some of the  constant strings.
>>
>>  Give me an example of a string that doesn't have a charset.
>>  The only example I can think of would be a binary string.
>>  Are there others?
>>
>>  >
>>  >Imagine the application which would  Recieve emails, convert them from
>>  >specified encoding to unicode and store in the database.
>>  >
>>  >The other thing is I belive it could be made optional :)
>
>Yes. You're completely right and one will use binary string in the example
>I'm refering too as everything else may read to garbage.  Thus binary string
>also has "binary" charset but it does not mean you want to use it as from
>charset.


As it happens, even binary strings have a charset currently:

SELECT CHARSET(BINARY 'abc') -> latin1

(the server's default character set is used).  So I suppose that the utility
of the charset_from argument is to specify a charset for data for which
the server has not assigned an appropriate charset? (As in your example
when you get text from a mail message.)

What about the apparent reversal of the 2nd and 3rd arguments?  Am I
misinterpreting something, or are they misnamed?

>
>
>--
>     __  ___     ___ ____  __
>    /  |/  /_ __/ __/ __ \/ /    Mr. Peter Zaitsev <peter@stripped>
>   / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Full-Time Developer
>  /_/  /_/\_, /___/\___\_\___/   Moscow, Russia
>         <___/   www.mysql.com   M: +7 095 725 4955

Thread
bk commit into 4.1 treebar29 Mar
  • Re: bk commit into 4.1 treePaul DuBois29 Mar
  • Question about CONVERT(str,charset_to,charset_from)Paul DuBois18 Oct
    • Re: Question about CONVERT(str,charset_to,charset_from)Peter Zaitsev18 Oct
      • Re: Question about CONVERT(str,charset_to,charset_from)Paul DuBois18 Oct
  • Re: Question about CONVERT(str,charset_to,charset_from)Shurik) Barkov20 Oct
    • Re: Question about CONVERT(str,charset_to,charset_from)Michael Widenius20 Oct
Re: Question about CONVERT(str,charset_to,charset_from)Paul DuBois18 Oct