Author Topic: utf-8 not working????  (Read 352 times)

Offline nykS

  • Single posting newcomer
  • *
  • Posts: 3
utf-8 not working????
« on: November 19, 2018, 10:10:14 am »
Hello, folks!
I have a problem with the Codeblocks. When I want to write the "Δ" it shows me a square.

Image

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11279
    • Travis build status
Re: utf-8 not working????
« Reply #1 on: November 19, 2018, 10:40:01 am »
Have you checked the Editor settings? I don't think we enable UTF-8 by default on Windows, I guess we use your systems default.
What is the selected encoding for the file you're editing (edit->file encoding)?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2105
Re: utf-8 not working????
« Reply #2 on: November 19, 2018, 10:28:15 pm »
Does the used font supports this symbol?

Offline nykS

  • Single posting newcomer
  • *
  • Posts: 3
Re: utf-8 not working????
« Reply #3 on: November 20, 2018, 04:21:04 pm »
Have you checked the Editor settings? I don't think we enable UTF-8 by default on Windows, I guess we use your systems default.
What is the selected encoding for the file you're editing (edit->file encoding)?

Is selected UTF-8.

Does the used font supports this symbol?

You right! Thank you!

But when I compile it shows me "╬" instead of "Δ", why?
« Last Edit: November 20, 2018, 04:26:01 pm by nykS »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11279
    • Travis build status
Re: utf-8 not working????
« Reply #4 on: November 20, 2018, 07:16:29 pm »
But when I compile it shows me "╬" instead of "Δ", why?
Where does it show it? Do you use the same font in the two places? Have you told the compiler that your source files are in a specific encoding. If you want to enter specific characters it is probably most reliable if you enter unicode values directly using \x, \u, \U or something similar.

https://stackoverflow.com/questions/6796157/unicode-encoding-for-string-literals-in-c11

I'm not expert, you'll have to search for more information how to solve your problem...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2105

Offline nykS

  • Single posting newcomer
  • *
  • Posts: 3
Re: utf-8 not working????
« Reply #6 on: November 21, 2018, 09:33:47 am »
But when I compile it shows me "╬" instead of "Δ", why?
Where does it show it? Do you use the same font in the two places? Have you told the compiler that your source files are in a specific encoding. If you want to enter specific characters it is probably most reliable if you enter unicode values directly using \x, \u, \U or something similar.

https://stackoverflow.com/questions/6796157/unicode-encoding-for-string-literals-in-c11

I'm not expert, you'll have to search for more information how to solve your problem...

How can I use the same font in console ? How I tell to the compiler ? \x, \u, \U not working...

http://forums.codeblocks.org/index.php/topic,22168.msg150872.html#msg150872

Image

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2105
Re: utf-8 not working????
« Reply #7 on: November 21, 2018, 10:31:21 am »
I think you have not changed the font in the console...
Step 3 in my description

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2105
Re: utf-8 not working????
« Reply #8 on: November 21, 2018, 10:54:27 am »
You also did not saved your document in UTF-8, as described in the error message on the right bottom.
Save the file as UTF-8 with Edit->File encoding->UTF-8