The log level patch has been applied. This one requires some thought. Ideally 
we should decode to  RFC 2047 format, and encode to the MM1 format. And this 
should apply to more than just the "subject" field. More work than this. I need 
to do it, but first (and it's friday, which means lazy days) I need a cleaned 
mapping from MIBEnum values to charset names (from 
http://www.iana.org/assignments/character-sets ) in a format that libiconv can 
understand. If you are feeling less lazy, you could put these into a text file 
for me (col1 = mib enum, col2 = name) and I'll do the code changes.

:)

P.

On Nov 26, 2010, at 15:21, Piotr Isajew wrote:

> I tested this for MM1 outgoing messages and it works. I don't know if
> it will perform ok (or does matter) for other protocols.
> 
> --- mbuni-cvs/mmlib/mms_msg.c 2010-10-26 12:18:13.000000000 +0200
> +++ mbuni/mmlib/mms_msg.c     2010-11-26 13:05:18.950730650 +0100
> @@ -53,6 +53,34 @@
>      wsp_pack_short_integer(s, c);
> }
> 
> +static void pack_utf8_encoded_text(Octstr *s, Octstr *value)
> +{
> +  const unsigned short short_len = 30;
> +  const unsigned char length_quote = 31;
> +  const unsigned char utf8_enc = 0x6a;
> +  int need_space =  octstr_get_char(value, 0) > 0x7f; /* see below */
> +  unsigned long len = octstr_len(value) + 2 + need_space;
> +  /* Pack value length */
> +  if(len <= short_len) {
> +    octstr_append_char(s, len);
> +  } else {
> +    octstr_append_char(s, length_quote);
> +    octstr_append_uintvar(s, len);
> +  }
> +  /* Pack encoding */
> +  wsp_pack_short_integer(s, utf8_enc);
> +
> +  /* Pack the rest */
> +  if(need_space) {
> +    /* it looks like if UTF-8 character goes first, it's not properly
> +       decoded on handsets, so we insert a space before it. Ugly, but
> +       appears to work. */
> +    octstr_append_char(s, 0x20);
> +  }
> +  octstr_append(s, value);
> +  octstr_append_char(s, 0);
> +}
> +
> #if 0
> static void encode_uint(Octstr *os, unsigned int l)
> {
> @@ -683,11 +711,12 @@
>      unsigned char c;
> 
>      switch (field_type) {
> -       
> +     case MMS_HEADER_SUBJECT:
> +       pack_utf8_encoded_text(os, value);
> +       break;
>      case MMS_HEADER_TO:
>      case MMS_HEADER_CC:
>      case MMS_HEADER_BCC:
> -     case MMS_HEADER_SUBJECT:
>      case MMS_HEADER_TRANSACTION_ID:
>      case MMS_HEADER_MESSAGE_ID:
>      case MMS_HEADER_REPLY_CHARGING_ID:
> @@ -695,8 +724,8 @@
> 
>      case MMS_HEADER_STORE_STATUS_TEXT:
>         
> -       wsp_pack_text(os, value); /* XXX need to deal with charset issues. */
> -       break;               
> +               wsp_pack_text(os, value); /* XXX need to deal with charset 
> issues. */
> +         break;             
>         
>      case MMS_HEADER_RESPONSE_TEXT: /* make sure response status does not 
> begin with digit!! Has special meaning*/
>      case MMS_HEADER_CONTENT_LOCATION:
> _______________________________________________
> Devel mailing list
> Devel@mbuni.org
> http://lists.mbuni.org/mailman/listinfo/devel

_______________________________________________
Devel mailing list
Devel@mbuni.org
http://lists.mbuni.org/mailman/listinfo/devel

Reply via email to