Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
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
Esteban Blanc
proview
Commits
4f097a00
Commit
4f097a00
authored
Jun 01, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utf8 <-> iso8859 conversion
parent
fd1ccabf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
0 deletions
+76
-0
src/lib/co/src/co_cnv.c
src/lib/co/src/co_cnv.c
+55
-0
src/lib/co/src/co_cnv.h
src/lib/co/src/co_cnv.h
+21
-0
No files found.
src/lib/co/src/co_cnv.c
0 → 100644
View file @
4f097a00
/*
* Proview $Id: co_cnv.c,v 1.1 2007-06-01 11:26:06 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <float.h>
#include <string.h>
#include <iconv.h>
#include "co_cnv.h"
char
*
cnv_iso8859_to_utf8
(
char
*
iso
,
size_t
iso_size
)
{
static
iconv_t
cd
=
0
;
static
char
utf8
[
2048
];
char
*
utf8p
=
utf8
;
size_t
utf8_size
=
sizeof
(
utf8
);
if
(
!
cd
)
cd
=
iconv_open
(
"UTF-8"
,
"ISO8859-1"
);
if
(
iconv
(
cd
,
&
iso
,
&
iso_size
,
&
utf8p
,
&
utf8_size
)
==
(
size_t
)(
-
1
))
strcpy
(
utf8
,
""
);
return
utf8
;
}
char
*
cnv_utf8_to_iso8859
(
char
*
utf8
,
size_t
utf8_size
)
{
static
iconv_t
cd
=
0
;
static
char
iso
[
2048
];
char
*
isop
=
iso
;
size_t
iso_size
=
sizeof
(
iso
);
if
(
!
cd
)
cd
=
iconv_open
(
"ISO8859-1"
,
"UTF-8"
);
if
(
iconv
(
cd
,
&
utf8
,
&
utf8_size
,
&
isop
,
&
iso_size
)
==
(
size_t
)(
-
1
))
strcpy
(
iso
,
""
);
return
iso
;
}
src/lib/co/src/co_cnv.h
0 → 100644
View file @
4f097a00
/*
* Proview $Id: co_cnv.h,v 1.1 2007-06-01 11:26:06 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
char
*
cnv_utf8_to_iso8859
(
char
*
utf8
,
size_t
utf8_size
);
char
*
cnv_iso8859_to_utf8
(
char
*
iso
,
size_t
iso_size
);
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