Mercurial > pidgin.yaz
comparison libpurple/util.c @ 27872:ac9d95f61e7c
changed encoding for libpurple/util.c to utf-8.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 20 Aug 2008 22:35:25 +0000 |
parents | 05fe17b2ee55 |
children | 5c76f76ee9db |
comparison
equal
deleted
inserted
replaced
27871:05fe17b2ee55 | 27872:ac9d95f61e7c |
---|---|
4792 | 4792 |
4793 for(i=0;i<len;i+=2){ | 4793 for(i=0;i<len;i+=2){ |
4794 switch(*(ucs+i)){ | 4794 switch(*(ucs+i)){ |
4795 case 0x00: | 4795 case 0x00: |
4796 switch(*(ucs+i+1)){ | 4796 switch(*(ucs+i+1)){ |
4797 case 0xa2: // ¡ñ | 4797 case 0xa2: // ¢ |
4798 *(ucs+i) = 0xff; | 4798 *(ucs+i) = 0xff; |
4799 *(ucs+i+1) = 0xe0; | 4799 *(ucs+i+1) = 0xe0; |
4800 break; | 4800 break; |
4801 case 0xa3: // ¡ò | 4801 case 0xa3: // £ |
4802 *(ucs+i) = 0xff; | 4802 *(ucs+i) = 0xff; |
4803 *(ucs+i+1) = 0xe1; | 4803 *(ucs+i+1) = 0xe1; |
4804 break; | 4804 break; |
4805 case 0xac: // ¢Ì | 4805 case 0xac: // ¬ |
4806 *(ucs+i) = 0xff; | 4806 *(ucs+i) = 0xff; |
4807 *(ucs+i+1) = 0xe2; | 4807 *(ucs+i+1) = 0xe2; |
4808 break; | 4808 break; |
4809 } | 4809 } |
4810 break; | 4810 break; |
4811 case 0x20: // ¡Â | 4811 case 0x20: // ‖ |
4812 if(*(ucs+i+1) == 0x16){ | 4812 if(*(ucs+i+1) == 0x16){ |
4813 *(ucs+i) = 0x22; | 4813 *(ucs+i) = 0x22; |
4814 *(ucs+i+1) = 0x25; | 4814 *(ucs+i+1) = 0x25; |
4815 } | 4815 } |
4816 break; | 4816 break; |
4817 case 0x22: // ¡Ý | 4817 case 0x22: // − |
4818 if(*(ucs+i+1) == 0x12){ | 4818 if(*(ucs+i+1) == 0x12){ |
4819 *(ucs+i) = 0xff; | 4819 *(ucs+i) = 0xff; |
4820 *(ucs+i+1) = 0x0d; | 4820 *(ucs+i+1) = 0x0d; |
4821 } | 4821 } |
4822 break; | 4822 break; |
4823 case 0x30: // ¡Á | 4823 case 0x30: // 〜 |
4824 if(*(ucs+i+1) == 0x1c){ | 4824 if(*(ucs+i+1) == 0x1c){ |
4825 *(ucs+i) = 0xff; | 4825 *(ucs+i) = 0xff; |
4826 *(ucs+i+1) = 0x5e; | 4826 *(ucs+i+1) = 0x5e; |
4827 } | 4827 } |
4828 break; | 4828 break; |
4848 | 4848 |
4849 for(i=0;i<len;i+=2){ | 4849 for(i=0;i<len;i+=2){ |
4850 switch(*(ucs+i)){ | 4850 switch(*(ucs+i)){ |
4851 case 0x22: | 4851 case 0x22: |
4852 switch(*(ucs+i+1)){ | 4852 switch(*(ucs+i+1)){ |
4853 case 0x25: // ¡Â | 4853 case 0x25: // ‖ |
4854 *(ucs+i) = 0x20; | 4854 *(ucs+i) = 0x20; |
4855 *(ucs+i+1) = 0x16; | 4855 *(ucs+i+1) = 0x16; |
4856 break; | 4856 break; |
4857 } | 4857 } |
4858 break; | 4858 break; |
4859 case 0xff: | 4859 case 0xff: |
4860 switch(*(ucs+i+1)){ | 4860 switch(*(ucs+i+1)){ |
4861 case 0x0d: // ¡Ý | 4861 case 0x0d: // − |
4862 *(ucs+i) = 0x22; | 4862 *(ucs+i) = 0x22; |
4863 *(ucs+i+1) = 0x12; | 4863 *(ucs+i+1) = 0x12; |
4864 break; | 4864 break; |
4865 case 0x5e: // ¡Á | 4865 case 0x5e: // 〜 |
4866 *(ucs+i) = 0x30; | 4866 *(ucs+i) = 0x30; |
4867 *(ucs+i+1) = 0x1c; | 4867 *(ucs+i+1) = 0x1c; |
4868 break; | 4868 break; |
4869 case 0xe0: // ¡ñ | 4869 case 0xe0: // ¢ |
4870 *(ucs+i) = 0x00; | 4870 *(ucs+i) = 0x00; |
4871 *(ucs+i+1) = 0xa2; | 4871 *(ucs+i+1) = 0xa2; |
4872 break; | 4872 break; |
4873 case 0xe1: // ¡ò | 4873 case 0xe1: // £ |
4874 *(ucs+i) = 0x00; | 4874 *(ucs+i) = 0x00; |
4875 *(ucs+i+1) = 0xa3; | 4875 *(ucs+i+1) = 0xa3; |
4876 break; | 4876 break; |
4877 case 0xe2: // ¢Ì | 4877 case 0xe2: // ¬ |
4878 *(ucs+i) = 0x00; | 4878 *(ucs+i) = 0x00; |
4879 *(ucs+i+1) = 0xac; | 4879 *(ucs+i+1) = 0xac; |
4880 break; | 4880 break; |
4881 } | 4881 } |
4882 break; | 4882 break; |
4916 | 4916 |
4917 for(i=0;i<len;i++){ | 4917 for(i=0;i<len;i++){ |
4918 switch(*(utf+i)){ | 4918 switch(*(utf+i)){ |
4919 case 0xe2: | 4919 case 0xe2: |
4920 if(*(utf+i+1) == 0x88) { | 4920 if(*(utf+i+1) == 0x88) { |
4921 if(*(utf+i+2) == 0xa5) { // ¡Â | 4921 if(*(utf+i+2) == 0xa5) { // ‖ |
4922 *(utf+i) = 0xe2; | 4922 *(utf+i) = 0xe2; |
4923 *(utf+i+1) = 0x80; | 4923 *(utf+i+1) = 0x80; |
4924 *(utf+i+2) = 0x96; | 4924 *(utf+i+2) = 0x96; |
4925 } | 4925 } |
4926 } | 4926 } |
4927 break; | 4927 break; |
4928 case 0xef: | 4928 case 0xef: |
4929 switch(*(utf+i+1)){ | 4929 switch(*(utf+i+1)){ |
4930 case 0xbc: | 4930 case 0xbc: |
4931 if(*(utf+i+2) == 0x8d) { // ¡Ý | 4931 if(*(utf+i+2) == 0x8d) { // − |
4932 *(utf+i) = 0xe2; | 4932 *(utf+i) = 0xe2; |
4933 *(utf+i+1) = 0x88; | 4933 *(utf+i+1) = 0x88; |
4934 *(utf+i+2) = 0x92; | 4934 *(utf+i+2) = 0x92; |
4935 } | 4935 } |
4936 break; | 4936 break; |
4937 case 0xbd: | 4937 case 0xbd: |
4938 if(*(utf+i+2) == 0x9e) { // ¡Á | 4938 if(*(utf+i+2) == 0x9e) { // 〜 |
4939 *(utf+i) = 0xe3; | 4939 *(utf+i) = 0xe3; |
4940 *(utf+i+1) = 0x80; | 4940 *(utf+i+1) = 0x80; |
4941 *(utf+i+2) = 0x9c; | 4941 *(utf+i+2) = 0x9c; |
4942 } | 4942 } |
4943 break; | 4943 break; |
4944 case 0xbf: | 4944 case 0xbf: |
4945 switch(*(utf+i+2)){ | 4945 switch(*(utf+i+2)){ |
4946 case 0xa0: // ¡ñ | 4946 case 0xa0: // ¢ |
4947 *(utf+i) = 0xc2; | 4947 *(utf+i) = 0xc2; |
4948 *(utf+i+1) = 0xa2; | 4948 *(utf+i+1) = 0xa2; |
4949 memmove(utf+i+2, utf+i+3, | 4949 memmove(utf+i+2, utf+i+3, |
4950 len-i-3); //shorten by 1byte | 4950 len-i-3); //shorten by 1byte |
4951 bytes--; | 4951 bytes--; |
4952 break; | 4952 break; |
4953 case 0xa1: // ¡ò | 4953 case 0xa1: // £ |
4954 *(utf+i) = 0xc2; | 4954 *(utf+i) = 0xc2; |
4955 *(utf+i+1) = 0xa3; | 4955 *(utf+i+1) = 0xa3; |
4956 memmove(utf+i+2, utf+i+3, | 4956 memmove(utf+i+2, utf+i+3, |
4957 len-i-3); //shorten by 1byte | 4957 len-i-3); //shorten by 1byte |
4958 bytes--; | 4958 bytes--; |
4959 break; | 4959 break; |
4960 case 0xa2: // ¢Ì | 4960 case 0xa2: // ¬ |
4961 *(utf+i) = 0xc2; | 4961 *(utf+i) = 0xc2; |
4962 *(utf+i+1) = 0xac; | 4962 *(utf+i+1) = 0xac; |
4963 memmove(utf+i+2, utf+i+3, | 4963 memmove(utf+i+2, utf+i+3, |
4964 len-i-3); //shorten by 1byte | 4964 len-i-3); //shorten by 1byte |
4965 bytes--; | 4965 bytes--; |
5008 | 5008 |
5009 for(i=0;i<bytes;i++){ | 5009 for(i=0;i<bytes;i++){ |
5010 switch(*(utf+i)){ | 5010 switch(*(utf+i)){ |
5011 case 0xc2: | 5011 case 0xc2: |
5012 switch(*(utf+i+1)){ | 5012 switch(*(utf+i+1)){ |
5013 case 0xa2: // ¡ñ | 5013 case 0xa2: // ¢ |
5014 *(utf+i) = 0xef; | 5014 *(utf+i) = 0xef; |
5015 *(utf+i+1) = 0xbf; | 5015 *(utf+i+1) = 0xbf; |
5016 memmove(utf+i+3, utf+i+2, bytes-i-2); | 5016 memmove(utf+i+3, utf+i+2, bytes-i-2); |
5017 *(utf+i+2) = 0xa0; | 5017 *(utf+i+2) = 0xa0; |
5018 bytes++; | 5018 bytes++; |
5019 break; | 5019 break; |
5020 case 0xa3: // ¡ò | 5020 case 0xa3: // £ |
5021 *(utf+i) = 0xef; | 5021 *(utf+i) = 0xef; |
5022 *(utf+i+1) = 0xbf; | 5022 *(utf+i+1) = 0xbf; |
5023 memmove(utf+i+3, utf+i+2, bytes-i-2); | 5023 memmove(utf+i+3, utf+i+2, bytes-i-2); |
5024 *(utf+i+2) = 0xa1; | 5024 *(utf+i+2) = 0xa1; |
5025 bytes++; | 5025 bytes++; |
5026 break; | 5026 break; |
5027 case 0xac: // ¢Ì | 5027 case 0xac: // ¬ |
5028 *(utf+i) = 0xef; | 5028 *(utf+i) = 0xef; |
5029 *(utf+i+1) = 0xbf; | 5029 *(utf+i+1) = 0xbf; |
5030 memmove(utf+i+3, utf+i+2, bytes-i-2); | 5030 memmove(utf+i+3, utf+i+2, bytes-i-2); |
5031 *(utf+i+2) = 0xa2; | 5031 *(utf+i+2) = 0xa2; |
5032 bytes++; | 5032 bytes++; |
5033 break; | 5033 break; |
5034 } | 5034 } |
5035 break; | 5035 break; |
5036 case 0xe2: | 5036 case 0xe2: |
5037 switch(*(utf+i+1)){ | 5037 switch(*(utf+i+1)){ |
5038 case 0x80: // ¡Â | 5038 case 0x80: // ‖ |
5039 if(*(utf+i+2) == 0x96){ | 5039 if(*(utf+i+2) == 0x96){ |
5040 *(utf+i) = 0xe2; | 5040 *(utf+i) = 0xe2; |
5041 *(utf+i+1) = 0x88; | 5041 *(utf+i+1) = 0x88; |
5042 *(utf+i+2) = 0xa5; | 5042 *(utf+i+2) = 0xa5; |
5043 } | 5043 } |
5044 break; | 5044 break; |
5045 case 0x88: // ¡Ý | 5045 case 0x88: // − |
5046 if(*(utf+i+1) == 0x92){ | 5046 if(*(utf+i+1) == 0x92){ |
5047 *(utf+i) = 0xef; | 5047 *(utf+i) = 0xef; |
5048 *(utf+i+1) = 0xbc; | 5048 *(utf+i+1) = 0xbc; |
5049 *(utf+i+2) = 0x8d; | 5049 *(utf+i+2) = 0x8d; |
5050 } | 5050 } |
5051 break; | 5051 break; |
5052 } | 5052 } |
5053 break; | 5053 break; |
5054 case 0xe3: // ¡Á | 5054 case 0xe3: // 〜 |
5055 if(*(utf+i+1) == 0x80){ | 5055 if(*(utf+i+1) == 0x80){ |
5056 if(*(utf+i+2) == 0x9c){ | 5056 if(*(utf+i+2) == 0x9c){ |
5057 *(utf+i) = 0xef; | 5057 *(utf+i) = 0xef; |
5058 *(utf+i+1) = 0xbd; | 5058 *(utf+i+1) = 0xbd; |
5059 *(utf+i+2) = 0x9e; | 5059 *(utf+i+2) = 0x9e; |