Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
2ae73cb3
Commit
2ae73cb3
authored
May 28, 2018
by
Mickaël Turnel
Browse files
Changed charset conversion function from 'any to any' to 'any to utf8'
Update bctoolbox for this commit to work
parent
a9233ebd
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/linphone/utils/utils.h
View file @
2ae73cb3
...
...
@@ -129,7 +129,7 @@ namespace Utils {
LINPHONE_PUBLIC
std
::
string
localeToUtf8
(
const
std
::
string
&
str
);
LINPHONE_PUBLIC
std
::
string
utf8ToLocale
(
const
std
::
string
&
str
);
LINPHONE_PUBLIC
std
::
string
convert
String
(
const
std
::
string
&
str
,
const
std
::
string
&
from
,
const
std
::
string
&
to
);
LINPHONE_PUBLIC
std
::
string
convert
AnyToUtf8
(
const
std
::
string
&
str
,
const
std
::
string
&
encoding
);
}
LINPHONE_END_NAMESPACE
...
...
src/chat/chat-message/chat-message.cpp
View file @
2ae73cb3
...
...
@@ -457,7 +457,7 @@ static void forceUtf8Content (Content &content) {
charset
=
charset
.
substr
(
begin
,
end
-
begin
);
if
(
Utils
::
stringToLower
(
charset
)
!=
"utf-8"
)
{
string
utf8Body
=
Utils
::
convert
String
(
content
.
getBodyAsUtf8String
(),
charset
,
"UTF-8"
);
string
utf8Body
=
Utils
::
convert
AnyToUtf8
(
content
.
getBodyAsUtf8String
(),
charset
);
if
(
!
utf8Body
.
empty
())
{
// TODO: use move operator if possible in the future!
content
.
setBodyFromUtf8
(
utf8Body
);
...
...
src/utils/utils.cpp
View file @
2ae73cb3
...
...
@@ -243,8 +243,8 @@ string Utils::utf8ToLocale (const string &str) {
return
localeStr
;
}
string
Utils
::
convert
String
(
const
string
&
str
,
const
string
&
from
,
const
string
&
to
)
{
char
*
cStr
=
bctbx_convert_
from_to
(
str
.
c_str
(),
from
.
c_str
(),
to
.
c_str
());
string
Utils
::
convert
AnyToUtf8
(
const
string
&
str
,
const
string
&
encoding
)
{
char
*
cStr
=
bctbx_convert_
any_to_utf8
(
str
.
c_str
(),
encoding
.
c_str
());
string
convertedStr
=
cStringToCppString
(
cStr
);
bctbx_free
(
cStr
);
return
convertedStr
;
...
...
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