Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sbkclient
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李定达
sbkclient
Commits
1606d0df
Commit
1606d0df
authored
Jul 21, 2017
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.添加RES版本的GBK编码的转换
parent
55e2a1e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
ZH_Client.suo
+0
-0
ZH_Client/sbk_client.cpp
+16
-3
No files found.
ZH_Client.suo
View file @
1606d0df
No preview for this file type
ZH_Client/sbk_client.cpp
View file @
1606d0df
...
@@ -767,7 +767,11 @@ extern "C"
...
@@ -767,7 +767,11 @@ extern "C"
{
{
string
outstr
;
string
outstr
;
JsonToRES
(
string
(
ERROR_RESINDATA
),
outstr
);
JsonToRES
(
string
(
ERROR_RESINDATA
),
outstr
);
strcpy
(
outdata
,
outstr
.
data
());
char
buftmp
[
MAX_BUF_LEN
]
=
{
0
};
char
tmpoutdata
[
MAX_BUF_LEN
]
=
{
0
};
strcpy
(
tmpoutdata
,
outstr
.
data
());
UTF8ToGBK
((
unsigned
char
*
)
tmpoutdata
,
(
unsigned
char
*
)
buftmp
,
MAX_BUF_LEN
);
strcpy
(
outdata
,
buftmp
);
LOG
()
<<
"send RES outdata : "
<<
outdata
;
LOG
()
<<
"send RES outdata : "
<<
outdata
;
return
0
;
return
0
;
}
}
...
@@ -786,12 +790,20 @@ extern "C"
...
@@ -786,12 +790,20 @@ extern "C"
{
{
string
outstr
;
string
outstr
;
JsonToRES
(
string
(
ERROR_OUTDATA
),
outstr
);
JsonToRES
(
string
(
ERROR_OUTDATA
),
outstr
);
strcpy
(
outdata
,
outstr
.
data
());
char
buftmp
[
MAX_BUF_LEN
]
=
{
0
};
char
tmpoutdata
[
MAX_BUF_LEN
]
=
{
0
};
strcpy
(
tmpoutdata
,
outstr
.
data
());
UTF8ToGBK
((
unsigned
char
*
)
tmpoutdata
,
(
unsigned
char
*
)
buftmp
,
MAX_BUF_LEN
);
strcpy
(
outdata
,
buftmp
);
LOG
()
<<
"send RES outdata : "
<<
outdata
;
LOG
()
<<
"send RES outdata : "
<<
outdata
;
return
0
;
return
0
;
}
}
strcpy
(
outdata
,
strout
.
data
());
char
buftmp
[
MAX_BUF_LEN
]
=
{
0
};
char
tmpoutdata
[
MAX_BUF_LEN
]
=
{
0
};
strcpy
(
tmpoutdata
,
strout
.
data
());
UTF8ToGBK
((
unsigned
char
*
)
tmpoutdata
,
(
unsigned
char
*
)
buftmp
,
MAX_BUF_LEN
);
strcpy
(
outdata
,
buftmp
);
LOG
()
<<
"send RES outdata : "
<<
outdata
;
LOG
()
<<
"send RES outdata : "
<<
outdata
;
...
@@ -855,6 +867,7 @@ int UTF8ToGBK(unsigned char * lpUTF8Str,unsigned char * lpGBKStr,int nGBKStrLen)
...
@@ -855,6 +867,7 @@ int UTF8ToGBK(unsigned char * lpUTF8Str,unsigned char * lpGBKStr,int nGBKStrLen)
nRetLen
=
MultiByteToWideChar
(
CP_UTF8
,
0
,(
char
*
)
lpUTF8Str
,
-
1
,
NULL
,
NULL
);
//获取转换到Unicode编码后所需要的字符空间长度
nRetLen
=
MultiByteToWideChar
(
CP_UTF8
,
0
,(
char
*
)
lpUTF8Str
,
-
1
,
NULL
,
NULL
);
//获取转换到Unicode编码后所需要的字符空间长度
//lpUnicodeStr = new WCHAR[nRetLen + 1]; //为Unicode字符串空间
//lpUnicodeStr = new WCHAR[nRetLen + 1]; //为Unicode字符串空间
lpUnicodeStr
=
(
WCHAR
*
)
malloc
(
sizeof
(
WCHAR
)
*
(
nRetLen
+
1
));
lpUnicodeStr
=
(
WCHAR
*
)
malloc
(
sizeof
(
WCHAR
)
*
(
nRetLen
+
1
));
memset
(
lpUnicodeStr
,
0
,
nRetLen
+
1
);
nRetLen
=
MultiByteToWideChar
(
CP_UTF8
,
0
,(
char
*
)
lpUTF8Str
,
-
1
,
lpUnicodeStr
,
nRetLen
);
//转换到Unicode编码
nRetLen
=
MultiByteToWideChar
(
CP_UTF8
,
0
,(
char
*
)
lpUTF8Str
,
-
1
,
lpUnicodeStr
,
nRetLen
);
//转换到Unicode编码
if
(
!
nRetLen
)
//转换失败则出错退出
if
(
!
nRetLen
)
//转换失败则出错退出
return
0
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment