473,799 Members | 3,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3266
In article <ce**********@n ews.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**********@n ews.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
5073
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 () { srand(time(0)); int array_length; int count;
0
1032
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 dumped data. Unfortunately what I can see on the webpage is onll ? instead of respective national characters. What should be the procedure to migrate my 3.23 data to 4.1?
2
3425
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 raised a doubt in my mind on the same issue. Either through ignorance or incompetence, I've been unable to resolve some issues. 6.4.4.4p6 states...
1
3286
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 -- Deep Secrets, Perter van der Linden'. But I wonder why line 9 is ok but line 10 is illegal? Is what Keith Thompson said in another post also helpful to understand this question: "... The implicit conversion rule applies only to void*, not...
0
3669
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 Country/region: United States of America
3
1715
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 contains latin2 character ó (%F3) i have 404 page error.
3
9530
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++ code (ie. wrappers etc). In Managed C++ there was an automatic conversion between const char* and String^. This was useful to us for two reasons: 1. We declared our string constants as eg. const char* const c_My_Constant = "blah", and these...
5
2630
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 would like to convert this string to plain ascii (using some lookup table for latin2)
0
27262
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 are constrained by the technology available at the time of their development and hence aren’t optimum as per current scenario. One of such cases is the extensive usage of CHAR fields, which aren’t optimum solution for space storage now. This paper...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10482
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10225
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.