• WAP手机版 保存到桌面加入收藏设为首页
路由器

老毛子Padavan固件支持中文ssid设置的方法

时间:2016-07-30 15:29:33   作者:哎丫丫转载   阅读:7277   评论:2
内容摘要:首先特别感谢,恩山论坛的大大荒野无灯告知修改方法。。目前为止只支持中文ssidap发射,无线桥接暂时不支持。。。不过大神荒野无灯最新进度已经有测试版的支持无线桥接的方法咯。更多支持和疑问请参考原文地址跟帖:

首先特别感谢,恩山论坛的大大 荒野无灯 告知修改方法。。目前为止只支持中文ssid ap发射,无线桥接暂时不支持。。。不过大神 荒野无灯 最新进度已经有测试版的支持无线桥接的方法咯。

更多支持和疑问请参考原文地址跟帖:http://www.r*i*g*h*t.com.cn/forum/thread-190224-1-1.html

trunk/user/www/n56u_ribbon_fixed/general.js
修复方案:增加中文支持:

function validate_ssidchar(ch) {
    if (ch >= 32 && ch <= 126)
        return true;
+    if (ch >= 0x4e00 && ch <= 0x9fa5)
+        return true;

     return false;
}




修改 trunk/user/httpd/httpd.h

+extern void char_to_ascii(char *output, uint8_t *input);

-extern void char_to_ascii(char *output, char *input);


修改 trunk/user/httpd/aspbw.c 

定位char_to_ascii(char *output


/**

 * hex char to int

 * @author 荒野无灯

 * @date 2016-08-01 12:30

 * @param hex

 * @return int

 */

static int hex_char_to_int(const uint8_t *hex)

{

        int val;

        if(*hex >= '0' && *hex <='9') {

                val = (*hex - '0') * 16;

        } else {

                val = (*hex - 'A' + 10) * 16;

        }


        if(*(hex+1) >= '0' && *(hex+1) <='9') {

                val += (*(hex+1) - '0');

        } else {

                val += (*(hex+1) - 'A' +10);

        }

        return val;

}


/**

 * @author 荒野无灯

 * @date 2016-08-01 12:30

 * @param str the str to detect

 * @param sz string total bytes

 * @return

 */

static int can_be_chinese_utf8(const uint8_t *str, int sz)

{

        int len = strlen (str);

        if (sz < 6) {

                return 0;

        }


        if ((len >= 6) &&

                (hex_char_to_int(str) >= 0xe4 && hex_char_to_int(str) <= 0xe9)

                && (hex_char_to_int(str+2) >= 0x80 && hex_char_to_int(str+2) <= 0xbf)

                && (hex_char_to_int(str+4) >= 0x80 && hex_char_to_int(str+4) <= 0xbf)

                        ) {

                return 1;

        }

        if ( ((sz - len >= 2) && (len >=4)) &&

                 (hex_char_to_int(str-2) >= 0xe4 && hex_char_to_int(str-2) <= 0xe9)

                 && (hex_char_to_int(str) >= 0x80 && hex_char_to_int(str) <= 0xbf)

                 && (hex_char_to_int(str+2) >= 0x80 && hex_char_to_int(str+2) <= 0xbf)

                        ) {

                return 1;

        }

        if (((sz - len >= 4) && (len >= 2))

                && (hex_char_to_int(str-4) >= 0xe4 && hex_char_to_int(str-4) <= 0xe9 )

                && ((hex_char_to_int(str-2) >= 0x80 && hex_char_to_int(str-2) <= 0xbf)

                        || (hex_char_to_int(str) >= 0x80 && hex_char_to_int(str) <= 0xbf))) {

                return 1;

        }

        return 0;

}


/**

 * @author 荒野无灯

 * @date 2016-08-01 12:30

 * @param str the str to detect

 * @param sz string total bytes

 * @return int

 */

static int can_be_ascii_utf8(const uint8_t *str, int sz)

{

        int len = strlen (str);

        uint8_t the_char = hex_char_to_int(str);

        /*printf("ascii detect:  ascii_val: %d, canbe char: %c\n", the_char, the_char);*/

        if (( len >= 2) &&

                (the_char >= '0' && the_char <= '9')

                || (the_char >= 'A' && the_char <= 'Z')

                || (the_char >= 'a' && the_char <= 'z')

                || the_char == '!' || the_char == '*'

                || the_char == '(' || the_char == ')'

                || the_char == '_' || the_char == '-'

                || the_char == '\'' || the_char == '.') {

                return 1;

        }

        return 0;

}


/**

 * @param input the string to validate

 * @author 荒野无灯

 * @date 2016-08-01 12:30

 * @return int

 */

static int is_valid_hex_string(uint8_t *input)

{

        int i;

        int input_len, input_hex_len;

        char *input_ptr;


        //detect from index 2, skip char "0x"

        input_ptr = input+2;

        input_len = strlen(input);

        input_hex_len = input_len -2;

        int is_valid_ascii_or_Chinese = 1;

        //0xAA

        if(input_len >4 && input_len % 2 == 0 && input[0] == '0' && input[1] == 'x') {

                for ( i=0; i

                        if (!( ((*input_ptr>='0' && *input_ptr <='9') || ( *input_ptr >='A' && *input_ptr <='F'))

                                   && ((*(input_ptr+1) >='0' && *(input_ptr+1) <='9') || ( *(input_ptr+1) >='A' && *(input_ptr+1) <='F')))

                                        ) {

                                is_valid_ascii_or_Chinese = 0;

                                break;

                        }

                        if (!can_be_chinese_utf8(input_ptr, input_hex_len) && !can_be_ascii_utf8(input_ptr, input_hex_len)) {

                                is_valid_ascii_or_Chinese = 0;

                                break;

                        }

                }

        } else {

                is_valid_ascii_or_Chinese = 0;

        }

        return is_valid_ascii_or_Chinese;

}





/**

* detect Chinese

* @author 荒野无灯

* @param str the str to detect

* @param sz string total bytes

* @return

*/

void

char_to_ascii(char *output, uint8_t *input)

{

        int i;

        char tmp[10];

        char *ptr;

        int input_len;


        ptr = output;

        input_len = strlen(input);


        if(is_valid_hex_string(input)) {

                for ( i=2; i

                        sprintf(tmp, "%%%c%c", input[i], input[i+1]);

                        strcpy(ptr, tmp);

                        ptr+=3;

                }

        }  else {

                for ( i=0; i

                        if ((input[i]>='0' && input[i] <='9')

                                ||(input[i]>='A' && input[i]<='Z')

                                ||(input[i] >='a' && input[i]<='z')

                                || input[i] == '!' || input[i] == '*'

                                || input[i] == '(' || input[i] == ')'

                                || input[i] == '_' || input[i] == '-'

                                || input[i] == '\'' || input[i] == '.') {

                                *ptr = input[i];

                                ptr++;

                        } else {

                                sprintf(tmp, "%%%.02X", input[i]);

                                strcpy(ptr, tmp);

                                ptr += 3;

                        }

                }

        }

        *ptr = '\0';

}

老毛子Padavan固件支持中文ssid设置的方法


20160809 更新: 搞定无线桥接长中文ssid 显示

请备份原有文件用附件的文件即可支持中继长中文ssid显示

包括2.4 和5 Gh的支持

附件下载
   版权声明,所有转载都有注明出处,本站不负责承担任何法律责往。若有侵权,请联系我。我会及时删除。

电脑维护,系统安装,软 、硬件维修,电脑配件,零售业务,网站建设,路由器安装设置 服务器维护,电脑、网络维护,智能手机刷机,安装WIFI 调试!郴州网站建设 小程序搭建 郴州电脑维修

        咨询电话:18175576644  点击这里给我发消 息
   扫描二维码。关注公众号,小程序
       享受星级服务   

手机点击二维码关注
      


手机点击打开小程序
      


相关评论
免责申明:本站部分资料来源互联网,如果侵犯了您的版权,请作者速来电或QQ与本站联系,我们将第一时间给予以改正或删除。

Copyright © 2020 哎丫丫电脑 All Rights Reserved 
 工信部备案:湘ICP备14010293号-1