By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,677 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,677 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.