473,396 Members | 1,966 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.

Strange Spanish Question Mark (¿) Appearance at the Very Beginning of Output HTML Files Using C++

I only use C++ with Visual Studio 6.0 for string manipulations in
thousands of HTML pages on my website. Many times, the output files of
many of my C++ programs contain a spanish question mark (¿) as their
first character. What creates it? How do we avoid it?
Thanks!

maria
Jan 10 '08 #1
4 3589
On Thu, 10 Jan 2008 00:31:19 -0500, maria <maria@maria_de_napoli.com>
wrote in comp.lang.c++:
I only use C++ with Visual Studio 6.0 for string manipulations in
thousands of HTML pages on my website. Many times, the output files of
many of my C++ programs contain a spanish question mark (¿) as their
first character. What creates it? How do we avoid it?
Thanks!
My crystal ball says that the error is on line 42.

If you, who can look at the source code all you want, haven't found
the error, how do you expect anyone else to do so, without seeing the
code?

That character is there because your program writes it there. The
answer can only be found in your program.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Jan 10 '08 #2
On Jan 10, 6:48 am, Jack Klein <jackkl...@spamcop.netwrote:
On Thu, 10 Jan 2008 00:31:19 -0500, maria <maria@maria_de_napoli.com>
wrote in comp.lang.c++:
I only use C++ with Visual Studio 6.0 for string manipulations in
thousands of HTML pages on my website. Many times, the output files of
many of my C++ programs contain a spanish question mark (¿) as their
first character. What creates it? How do we avoid it?
Thanks!
My crystal ball says that the error is on line 42.
If you, who can look at the source code all you want, haven't found
the error, how do you expect anyone else to do so, without seeing the
code?
That character is there because your program writes it there. The
answer can only be found in your program.
More likely, the error is related to his environment, and
character coding issues. If he writes his code supposing one
encoding (perhaps unintentionally, he might just suppose the
encoding of his editor), and views the outpu in another, wierd
things can and will happen.

Of course, you're right that we don't have enough information to
even start guessing, and knowing exactly what he's trying to
output would certainly help. As would knowning how he's viewing
the files, to determine the presense of this character; even
more useful would be a hex dump of the start of the file. (In
Unicode and ISO 8859-1, the inverted question mark is 0xBF. I
don't see anything off hand which might insert such a character
arbitrarily, but perhaps the actual value in the file is
something else, which his viewing environment displays as an
inverted question mark.)

--
James Kanze (GABI Software) mailto:ja*********@gmail.com
Conseils en informatique orient�e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S�mard, 78210 St.-Cyr-l'�cole, France, +33 (0)1 30 23 00 34
Jan 10 '08 #3
On Thu, 10 Jan 2008 02:27:28 -0800 (PST), James Kanze
<ja*********@gmail.comwrote:
>On Jan 10, 6:48 am, Jack Klein <jackkl...@spamcop.netwrote:
>On Thu, 10 Jan 2008 00:31:19 -0500, maria <maria@maria_de_napoli.com>
wrote in comp.lang.c++:
I only use C++ with Visual Studio 6.0 for string manipulations in
thousands of HTML pages on my website. Many times, the output files of
many of my C++ programs contain a spanish question mark (¿) as their
first character. What creates it? How do we avoid it?
Thanks!
>My crystal ball says that the error is on line 42.
>If you, who can look at the source code all you want, haven't found
the error, how do you expect anyone else to do so, without seeing the
code?
>That character is there because your program writes it there. The
answer can only be found in your program.

More likely, the error is related to his environment, and
character coding issues. If he writes his code supposing one
encoding (perhaps unintentionally, he might just suppose the
encoding of his editor), and views the outpu in another, wierd
things can and will happen.

Of course, you're right that we don't have enough information to
even start guessing, and knowing exactly what he's trying to
output would certainly help. As would knowning how he's viewing
the files, to determine the presense of this character; even
more useful would be a hex dump of the start of the file. (In
Unicode and ISO 8859-1, the inverted question mark is 0xBF. I
don't see anything off hand which might insert such a character
arbitrarily, but perhaps the actual value in the file is
something else, which his viewing environment displays as an
inverted question mark.)
That is very correct, James. There is no way I have told my C++
programs to write a Spanish question mark at the beginning of a page.
The code is very simple:

string entry;
.... ...
while (getline(in,entry)) {
out.write(entry.c_str(),entry.size());
out.put('\n');
...
...
}
.... ...

The viewing environment is determined by the "UEdit"
and "Search and Replace" programs, and Firefox. They all see/create
a Spanish Question Mark or other little symbols, like
an inverted exclamation mark accompanied by a European-style quotation
mark, only AT THE BEGINNING of the file.
All these marks can be eliminated by the "Search and Replace" program.
After their elimination, they do not show up again anywhere before
the files get generated again by using C++ with Visual Studio 6.0.
I was just wondering why they are created to begin with, and why they
only show up at the beginnig of the output file.
Thank you very much!

maria
Jan 10 '08 #4
On 2008-01-11 05:11:54 -0500, James Kanze <ja*********@gmail.comsaid:
>
Well, it's sort of a C++ issue, in that the committee is
addressing it: the next version of C++ will (conditionally?)
have two types, char16_t and char32_t, which are guaranteed to
be UTF-16 and UTF-32 (if they are present).
Not conditionally. They're built-in types, equivalent in size, etc. to
uint_least16_t and uint_least32_t, respectively. For a few more
details, see the article at my web site.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

Jan 11 '08 #5

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

Similar topics

1
by: ryang | last post by:
I am trying to understand how to work with Unicode in Perl. I have read the relevant man pages (perluniintro, perlunicode, etc.) and have written severl scripts to test/verifiy my understanding. ...
0
by: Federico | last post by:
Hi all, I don't know if this topic is perhaps a little bit off-topic, anyway I have a strange problem in transforming an XML file in an HTML file using XSLT form a Java program written with...
5
by: mary | last post by:
When I read an HTML file starting with <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> and then I write it into another file, say OUTPUT.txt, I get an inverted question...
3
by: Chip | last post by:
There is surprisingly little information on the various encoding options for reading a text file. I have what seems to be a very basic issue: I'm reading a text file that includes Spanish...
5
by: sniper | last post by:
hi all; i'm doing here an autocompletion module in the envirnment (XFORMS/XHTML). this is the code: <?xml version="1.0" encoding="UTF-8"?> <xhtml:html xmlns="http://xforms.websynapsis.com"...
19
by: Alan Carpenter | last post by:
Access 8 on Win98 and WinXP I'm having trouble with wildcards in the .Filename property of the FileSearch Object giving different results on win98 and XP. I've been successfully using...
3
by: Chuck Renner | last post by:
Please help! This MIGHT even be a bug in PHP! I'll provide version numbers and site specific information (browser, OS, and kernel versions) if others cannot reproduce this problem. I'm...
112
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not...
10
by: laredotornado | last post by:
Hi, I have certain blocks of Spanish text, for example ¿Necesita agregar una impresora o copiadora adicional a su forma personalizada de orden? Presione aquí. Don't know if the backwards...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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,...
0
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...
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
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,...

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.