使用pcre库正则表达式处理非ASCII码时出现乱码的有关问题

使用pcre库正则表达式处理非ASCII码时出现乱码的问题
使用pcre库正则表达式处理非ASCII码时出现乱码的问题

pcre下载地址 http://www.psyon.org/projects/pcre-win32/index.php
我使用的是最后一个

代码如下
C/C++ code

// pcre79.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "pcre.h"
#include <stdio.h>   
#include <string.h>   
  
#define OVECCOUNT 30    /* should be a multiple of 3 */

int main(int argc, char* argv[])
{
    pcre *re;  
    const char *error;  
    int erroffset;  
    int ovector[OVECCOUNT];  
    int rc,i;  
  
    char src[]="123:156";                    //进行匹配的字符
    char pattern[]="[^123(:|:|( )*)?].*";     //正则表达式



    printf("string:%s\n",src);  
    printf("pattern:%s\n",pattern);  


    re=pcre_compile(pattern,0,&error,&erroffset,NULL);  
    if(re==NULL){  
        printf("pcre compilation failed at offset %d:%s\n",erroffset,error);  
        return 1;  
    }  
    rc=pcre_exec(re,NULL,src,strlen(src),0,0,ovector,OVECCOUNT);  
    if(rc<0){  
        if(rc==PCRE_ERROR_NOMATCH){  
            printf("sorry ,no match ...\n");  
        }  
        else{  
            printf("matching error %d\n",rc);  
            pcre_free(re);  
            return 1;  
        }  
    }  
   printf("\nok ,has matched ...\n\n");  
    for(i=0;i<rc;i++){  
        char *substring_start=src+ovector[2*i];  
        int substring_length=ovector[2*i+1]-ovector[2*i];  
        printf("$%2d :%.*s\n",i,substring_length,substring_start);

    }  
    pcre_free(re);  
    return 0;  
}




运行结果如下:



?6 就是乱码


如果改成
C/C++ code

    char src[]="123:156";                    //进行匹配的字符
    char pattern[]="[^123(:|( )*)?].*";     //正则表达式





或者
C/C++ code

    char src[]="123:的56";                    //进行匹配的字符
    char pattern[]="[^123(:|:|( )*)?].*";     //正则表达式





就成功了 

请问这是怎么回事  
怎么才能解决这个问题呢?


------解决方案--------------------
正则我了解的不多
不过不识别ascii码我觉得是不可能的
你看看这个工具有没有什么地方可以设置