Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
8f823600
Commit
8f823600
authored
Oct 21, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow cp932 characters to be stored in a SJIS column
parent
ffd77c46
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
3 deletions
+57
-3
mysql-test/r/ctype_sjis.result
mysql-test/r/ctype_sjis.result
+6
-0
mysql-test/t/ctype_sjis.test
mysql-test/t/ctype_sjis.test
+9
-0
strings/ctype-sjis.c
strings/ctype-sjis.c
+35
-1
strings/ctype-utf8.c
strings/ctype-utf8.c
+7
-2
No files found.
mysql-test/r/ctype_sjis.result
View file @
8f823600
...
...
@@ -41,3 +41,9 @@ C0C1C2C3C4C5C6C7C8C9CACBCCCDCECF
select hex(CONVERT(@utf84 USING sjis));
hex(CONVERT(@utf84 USING sjis))
D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF
create table t1 (a char(10) character set sjis);
insert into t1 values (0x878A);
select hex(a) from t1;
hex(a)
878A
drop table t1;
mysql-test/t/ctype_sjis.test
View file @
8f823600
...
...
@@ -32,3 +32,12 @@ select hex(CONVERT(@utf81 USING sjis));
select
hex
(
CONVERT
(
@
utf82
USING
sjis
));
select
hex
(
CONVERT
(
@
utf83
USING
sjis
));
select
hex
(
CONVERT
(
@
utf84
USING
sjis
));
#
# Allow to insert extra CP932 characters
# into a SJIS column
#
create
table
t1
(
a
char
(
10
)
character
set
sjis
);
insert
into
t1
values
(
0x878A
);
select
hex
(
a
)
from
t1
;
drop
table
t1
;
strings/ctype-sjis.c
View file @
8f823600
...
...
@@ -4563,6 +4563,40 @@ uint my_numcells_sjis(CHARSET_INFO *cs __attribute__((unused)),
return
clen
;
}
/*
Returns a well formed length of a SJIS string.
CP932 additional characters are also accepted.
*/
static
uint
my_well_formed_len_sjis
(
CHARSET_INFO
*
cs
__attribute__
((
unused
)),
const
char
*
b
,
const
char
*
e
,
uint
pos
)
{
const
char
*
b0
=
b
;
while
(
pos
&&
b
<
e
)
{
/*
Cast to int8 for extra safety.
"char" can be unsigned by default
on some platforms.
*/
if
(((
int8
)
b
[
0
])
>=
0
)
{
/* Single byte character */
b
+=
1
;
}
else
if
(
issjishead
((
uchar
)
*
b
)
&&
(
e
-
b
)
>
1
&&
issjistail
((
uchar
)
b
[
1
]))
{
/* Double byte character */
b
+=
2
;
}
else
{
/* Wrong byte sequence */
break
;
}
}
return
b
-
b0
;
}
static
MY_COLLATION_HANDLER
my_collation_ci_handler
=
...
...
@@ -4586,7 +4620,7 @@ static MY_CHARSET_HANDLER my_charset_handler=
mbcharlen_sjis
,
my_numchars_mb
,
my_charpos_mb
,
my_well_formed_len_
mb
,
my_well_formed_len_
sjis
,
my_lengthsp_8bit
,
my_numcells_sjis
,
my_mb_wc_sjis
,
/* mb_wc */
...
...
strings/ctype-utf8.c
View file @
8f823600
...
...
@@ -2126,8 +2126,13 @@ int my_strcasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t)
while
(
s
[
0
]
&&
t
[
0
])
{
my_wc_t
s_wc
,
t_wc
;
if
(
s
[
0
]
>=
0
)
/*
Cast to int8 for extra safety.
char can be unsigned by default
on some platforms.
*/
if
(((
int8
)
s
[
0
])
>=
0
)
{
/*
s[0] is between 0 and 127.
...
...
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