473,396 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

hex to *char conversion in latin2

d.
Hello,
I'm quite new in c programming. I'd like to convert string coded in any
language into Latin2. I thought that I do two things: first I convert
string to hex and then hex to latin2. But I have a problem with the second.
can anyone suggest how to do it?
or maybe there is better way to do so?
thanks a lot

d.

Nov 14 '05 #1
4 3247
In article <ce**********@news.lublin.pl>, d. wrote:
I'm quite new in c programming. I'd like to convert string coded in any
language into Latin2. I thought that I do two things: first I convert
string to hex and then hex to latin2. But I have a problem with the second.
can anyone suggest how to do it?
I don't see how converting to hex is going to help you.
or maybe there is better way to do so?
thanks a lot


C does not define character conversion. On unix, you may wish to check
iconv.
Ariane
--
We remember the song,
But not the hand that wrote it.
Nightwish -- Dead Boys Poem

Nov 14 '05 #2
d.
Converting to hex had to be common to all characters. Doesn't matter the
source is coded in utf8, latin1 or any kind of iso I can convert to hex
very simple.
It was just an idea. Do you know better way? I will try iconv.
thanks

d.

################################
# Always is the corner to turn #
################################

Ariane van der Steldt wrote:
In article <ce**********@news.lublin.pl>, d. wrote:
I'm quite new in c programming. I'd like to convert string coded in any
language into Latin2. I thought that I do two things: first I convert
string to hex and then hex to latin2. But I have a problem with the second.
can anyone suggest how to do it?

I don't see how converting to hex is going to help you.

or maybe there is better way to do so?
thanks a lot

C does not define character conversion. On unix, you may wish to check
iconv.
Ariane

Nov 14 '05 #3
d.
I've compiled the newest version of iconv and it works.
thx Ariane

d.

###############################
# Future Is Not Private Thing #
###############################

Ariane van der Steldt wrote:

(...)

C does not define character conversion. On unix, you may wish to check
iconv.
Ariane

Nov 14 '05 #4
d. writes:
I'm quite new in c programming. I'd like to convert string coded in any
language into Latin2. I thought that I do two things: first I convert
string to hex and then hex to latin2. But I have a problem with the second. can anyone suggest how to do it?
or maybe there is better way to do so?


I note that you seem to be in Poland. latin2 is a character set consisting
of 256 characters. Hex is a way of representing binary digits. I see no
point in introducing hex into the mix. You have a series of characters in
something, say latin1, and you want to convert these characters to latin2,
is this right? It is up to *you* to establish an equivalence, I don't seen
how any one else can do it for you. I have looked at latin2 and I can't
translate latin1 successfully into latin2 any more than I could translate
Egyptian hieroglyphics into the ordinary English/American latin character
set. I suppose I could get 95% of them right but the residue would be a
real stinker. I, like most Americans, only really understand the ASCII
subset of latin1, which I view, informally, as the "English latin" set.

So, *design* a 256 character mapping of source character to destination
character. You will have to do this once for each source character set.
Then, program wise, it is a simple table look up problem to translate.
There will be a one to one equivalence, even if your knowledge of the
underlying natural language does not want that to be so. But you would be
free to introduce the notion of "does not translate".

I think you got attracted by hex in the process of thinking of the table;
note that hex is just a mental crutch or notational convenience , it plays
no necessary part in the final solution. The 256 entry tranlation table
produced contains *binary* numbers, not hex numbers. For clarity, think of
a function

char to_latin2(char c);

which contains a static array of 256 characters.

Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
by: Tim Johansson | last post by:
I'm new to C++, and tried to start making a script that will shuffle an array. Can someone please tell me what's wrong? #include <iostream.h> #include <string.h> int main () {...
0
by: Mat | last post by:
Hi, I have upgraded my MySQL from 3.23 to 4.1.8. First of all I dumped my database with mysqldump. After installing new binary (debian woody) I have created respective database and uploaded my...
2
by: Peter Nilsson | last post by:
In a post regarding toupper(), Richard Heathfield once asked me to think about what the conversion of a char to unsigned char would mean, and whether it was sensible to actually do so. And pete has...
1
by: lovecreatesbeauty | last post by:
There is a warning/(error? I remember it is an error for line 10 on some compilers before. At least on g++, it is an error.) for line 10. I first read a similar example from `Expert C Programming...
0
by: Grzesiek | last post by:
Hey there! Please help me... I've got a iSeries (AS 400 with DB2), and I must connect to this database from Linux. On AS400 I've this settings (which I can't change): Language: Polish...
3
by: janecki | last post by:
I have a problem with Latin2 characters (for example: ó - %F3 ) My Example Rule: RewriteRule ^page,(.*)\.html$ page.php?name=$1 When I'm requesting: page,lobóz.html (witch...
3
by: Kevin Frey | last post by:
I am porting Managed C++ code from VS2003 to VS2005. Therefore adopting the new C++/CLI syntax rather than /clr:oldSyntax. Much of our managed code is concerned with interfacing to native C++...
5
by: Martin Landa | last post by:
Hi all, sorry for a newbie question. I have unicode string (or better say latin2 encoding) containing non-ascii characters, e.g. s = "Ukázka_možnosti_využití_programu_OpenJUMP_v_SOA" I...
0
by: maheshmohta | last post by:
Background Often while remodeling legacy application, one of the important tasks for the architects is to have an optimum usage of storage capabilities of database. Most of the legacy applications...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.