Показать сообщение отдельно

  #10  
Старый 19.04.2023, 18:35
Musaigen
Познавший АНТИЧАТ
Регистрация: 01.04.2018
Сообщений: 1,710
С нами: 4272230

Репутация: 183


По умолчанию

[QUOTE="Leatington"]

(обновлено), получилось с помощью следующей функции, спасибо.

C++:





Код:
std
::
string
CP1251_to_UTF8
(
const
char
*
str
)
{
std
::
string res
;
int
result_u
,
result_c
;
result_u
=
MultiByteToWideChar
(
1251
,
0
,
str
,
-
1
,
0
,
0
)
;
if
(
!
result_u
)
{
return
0
;
}
wchar_t
*
ures
=
new
wchar_t
[
result_u
]
;
if
(
!
MultiByteToWideChar
(
1251
,
0
,
str
,
-
1
,
ures
,
result_u
)
)
{
delete
[
]
ures
;
return
0
;
}
result_c
=
WideCharToMultiByte
(
65001
,
0
,
ures
,
-
1
,
0
,
0
,
0
,
0
)
;
if
(
!
result_c
)
{
delete
[
]
ures
;
return
0
;
}
char
*
cres
=
new
char
[
result_c
]
;
if
(
!
WideCharToMultiByte
(
65001
,
0
,
ures
,
-
1
,
cres
,
result_c
,
0
,
0
)
)
{
delete
[
]
cres
;
return
0
;
}
delete
[
]
ures
;
res
.
append
(
cres
)
;
delete
[
]
cres
;
return
res
;
}


Код:





[CODE]
std::string res = CP1251_to_UTF8(path.c_str());

sqlite3* users;
if (sqlite3_open(res.c_str(), &users))
{
std::cout
 
Ответить с цитированием