Author Topic: Ñ character error  (Read 2599 times)

Offline Pedro Luis

  • Single posting newcomer
  • *
  • Posts: 2
Ñ character error
« on: March 01, 2016, 05:44:19 pm »

//////////////////////////////////////
//   Character Ñ failed,
//   Mistake variable, depending on the character that precedes to hex \xa4
//
//////////////////////////////////////

#include <iostream>
using namespace std;

int main()
{
std::cout<<"\n Jos\x82 "; //José
std::cout<<"\n Espa\xa4a"; //España
std::cout<<"\n Espa\xa4 a"; //Españ a
std::cout<<"\n Espa\xa4e"; //Españe
std::cout<<"\n Espa\xa4i"; //España
std::cout<<"\n Espa\xa4o"; //España
std::cout<<"\n Espa\xa4u"; //España
    return 0;
}

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Ñ character error
« Reply #1 on: March 01, 2016, 06:37:38 pm »
Not related to Code::Blocks and therefore violating our forum rules.

Anyway, you can insert a double-double-quote after the hex-escape-sequence, that represents the ñ.

Offline Pedro Luis

  • Single posting newcomer
  • *
  • Posts: 2
Re: Ñ character error
« Reply #2 on: March 02, 2016, 01:18:19 am »
Thank you for the advice.

This just happens in hex. \xa4 +a or +e (works well with i, o, u)
Ñ-ñ on Decimal and Octal all works well.

My English is very basic, but I understand you:
Ex. cout<<"Espa\xa4""a"; //Works correctly
but cout<<"Espa\244a";   //in Octal it's faster to write

I hope this help other users that happens this strange error.