473,804 Members | 3,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write accents in C.

I am Latinanmerican an I would like to knonw how make accents using
printlf. Thanks.
Jan 17 '07 #1
5 4521
Gabriel Marinello wrote:
I am Latinanmerican an I would like to knonw how make accents using
printlf. Thanks.
The "portable" (C++/C99-specified but not widely implemented in C
compilers) way is to specify the Unicode code points.

printf("%s\n", "\u00E1\u00E8\u 00EF");

The more widely implemented way is to type accented characters directly
in the source code, but this will rely on your locale during
compilation matching that during editing.

printf("%s\n", "áèï");

In both cases, you can make it a bit more likely to work properly by
first calling the setlocale function, and then using a wide string for
printf:

printf("%ls %ls\n", L"\u00E1\u00E8\ u00EF", L"áèï");

Of course, there are systems that simply do not support accented
characters. If you're dealing with such a system, neither way will
work, for obvious reasons.

Jan 17 '07 #2
Harald van Dijk wrote, On 17/01/07 15:29:
Gabriel Marinello wrote:
>I am Latinanmerican an I would like to knonw how make accents using
printlf. Thanks.

The "portable" (C++/C99-specified but not widely implemented in C
compilers) way is to specify the Unicode code points.
<snip>

Where does the C99 standard require implementations to use Unicode? It
*might* make it an explicit option but I would be very surprised if it
mandated it.
--
Flash Gordon
Jan 21 '07 #3
Flash Gordon wrote:
Harald van Dijk wrote, On 17/01/07 15:29:
Gabriel Marinello wrote:
I am Latinanmerican an I would like to knonw how make accents using
printlf. Thanks.
The "portable" (C++/C99-specified but not widely implemented in C
compilers) way is to specify the Unicode code points.

<snip>

Where does the C99 standard require implementations to use Unicode? It
*might* make it an explicit option but I would be very surprised if it
mandated it.
If they don't use some form of Unicode for their char/wchar_t, they
must convert the characters. 6.4.3p4 states:
"The universal character name \Unnnnnnnn designates the character whose
eight-digit short identifier (as specified by ISO/IEC 10646) is
nnnnnnnn.63) Similarly, the universal character name \unnnn designates
the character whose four-digit short identifier is nnnn (and whose
eight-digit short identifier is 0000nnnn)."

(The differences between Unicode and ISO/IEC 10646 are not relevant in
this case.)

Jan 21 '07 #4
Harald van Dijk wrote, On 21/01/07 11:09:
Flash Gordon wrote:
>Harald van Dijk wrote, On 17/01/07 15:29:
>>Gabriel Marinello wrote:
I am Latinanmerican an I would like to knonw how make accents using
printlf. Thanks.
The "portable" (C++/C99-specified but not widely implemented in C
compilers) way is to specify the Unicode code points.
<snip>

Where does the C99 standard require implementations to use Unicode? It
*might* make it an explicit option but I would be very surprised if it
mandated it.

If they don't use some form of Unicode for their char/wchar_t, they
must convert the characters. 6.4.3p4 states:
<snip>

Thanks. That is useful to know. It would be even more useful if more
compilers supported C99, but that is a different issue ;-)
--
Flash Gordon
Jan 21 '07 #5
Gabriel Marinello wrote:
I am Latinanmerican an I would like to knonw how make accents using
printlf. Thanks.
You can try using the setlocale(3) and wchar_t related functions if you
are using wide chars.

Feb 8 '07 #6

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

Similar topics

5
4122
by: chepiok | last post by:
I'd like to send email containing accents (french one) using PHP command mail(). The content of these emails are store in text files. I'de like to know : - text file format (encoding, with ASCII code ?...) that will contains my templates with some potential accents - the right header that i should give to the mail commande
2
6368
by: c w | last post by:
Can anyone point me in the right direction? Using Oracle 9i, Pro*C and Excel. I am trying to print french accents from the Oracle DB using Pro*C to extract the necessary info and sent the result to Excel but at the moment I cannot get the accents to show in Excel. The NLS_LANG is America. Any help would be appreciated. Thanks. Colin
0
657
by: Wim Roffal | last post by:
When I sort texts with accents the accents end up in the end instead of near the same text without accent. For example, the 3 composers Hndel, Haydn and Holst will appear in the order Haydn, Holst, Hndel. Is it possible to instruct MySql to ignore the accents so that Hndel comes in first instead of last? Thanks in advance,
2
8442
by: Ghislain Benrais | last post by:
Hi everybody, I have xml documents with external entities for my accents that I want to output properly with php function domxml_open_file. I can't get my accents on a linux-apache server (I get "é" instead of ""). My browser is IE6. Do you know why ? A strange thing is that the very same script on the same document works fine on a windows-apache server. My xml document : <?xml version="1.0" ?> <!DOCTYPE survey >
0
1768
by: Chris Leffer | last post by:
Hi. I am having problems to use HtmlEncode with strings that use accents. My page uses some expressions like that: <%# Server.HtmlEncode(DataBinder.Eval(Container.DataItem, "Name").Trim) %> If the 'Name' has no accents all works well. But if the 'Name ' has accents they appear encoded, like Nã.
3
2481
by: jim | last post by:
Hi, I can't gte accents in the subject and body fields of an e-mail ! This is my code : document.location.href = 'mailto:webmaster@mysite.com?subject=the subject is lphant&body=elephant is said lphant in french !' ; When the e-mail appears, I get weird characters instead of the wanted clean accents.
1
3061
by: bssjohn | last post by:
Dear All, I have developing a French website using PHP & Ajax. In that I tried to display some French texts from mysql database using Ajax. Form local I got the text from db with Correct accents but in online French accents are missing. The text displays like this de r?isation pour regroup?a majorit?es . I declared following code in the head section of the file. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
0
1513
by: Johnny Jrgensen | last post by:
Has anyone got a good idea as to how I can systematically remove accents from characters in a string? I.e. I want to do a function that can change "Sgolne Royal" (just to take a current example) to "Segolene Royal" and the Swedish "frra" till "forara" etc... It is not important which language the string is in - all accents should be removed. Of course I can do a replace for each character, but if theres an easier way that will...
5
3369
by: arty | last post by:
i have set up a xhr , all the accents on the page are showed ok on ff an safari function _cms() { cms.open("GET", 'cms.php', true); cms.setRequestHeader('If-Modified-Since','Wed, 05 Apr 2006 00:00:00 GMT'); if (cms.overrideMimeType) { cms.overrideMimeType('text/html; charset=ISO-8859-1') } else{cms.setRequestHeader("Content-type", "text/html; charset=ISO-8859-1"); } cms.onreadystatechange = function() { if(cms.readyState ==...
0
9704
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10303
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,...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5508
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
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.