Question: Been having trouble with the print function, I know I'm missing something small. I've been looking everywhere and trying stuff out but can't seem to find the solution.

I'm trying to print braille characters in perl, I got the value of 2881 from a table and converted it to hexa. When I try to print the hexadecimal character, perl prints 3 characters instead.

Code:

```
#!/usr/local/bin/perl
  use utf8;
  print "\x{AF1}";

```

Output:

```
C:\Users\ElizabethTosh\Desktop>perl testff.pl
Wide character in print at testff.pl line 3.
α½▒

```

Answer: 
Issue #1: You need to tell Perl to encode the output for your terminal.

Add the following to your program.

```
use Win32 qw( );
use open ':std', ':encoding(cp'.Win32::GetConsoleOutputCP().')';

```

`use utf8;` merely specifies the that source file is encoded using UTF-8 instead of ASCII.

---

Issue #2: Your terminal probably can't handle that character.

The console of US-English machines likely expect [cp437](https://en.wikipedia.org/wiki/Code_page_437). It's character set doesn't include any braille characters.

You could try switching to code page 65001 (UTF-8) using `chcp 65001`. You may also need to switch the console's font to one that includes braille characters. (MS Gothic worked for me, although it does weird things to the backslashes.)

---

Issue #3: You have the wrong character code.

* `U+0AF1 GUJARATI RUPEE SIGN` (૱): `"\x{AF1}"` or `"\N{U+0AF1}"` or `chr(2801)`
* `U+0B41 ORIYA VOWEL SIGN U` (ୁ): `"\x{B41}"` or `"\N{U+0B41}"` or `chr(2881)`
* `U+2801 BRAILLE PATTERN DOTS-1` (⠁): `"\x{2801}"` or `"\N{U+2801}"` or `chr(10241)`
* `U+2881 BRAILLE PATTERN DOTS-18` (⢁): `"\x{2881}"` or `"\N{U+2881}"` or `chr(10369)`

---

All together,

```
use strict;
use warnings;
use feature qw( say );

use Win32 qw( );
use open ':std', ':encoding(cp'.Win32::GetConsoleOutputCP().')';

say(chr($_)) for 0x2801, 0x2881;

```

Output:

```
>chcp 65001
Active code page: 65001

>perl a.pl
⠁
⢁

```
If you save a character with UTF-8, and it's displayed as 3 strange characters instead of 1, it means that the character is in the range U+0800 to U+FFFF, and that you decode it with some single-byte encoding instead of UTF-8.

So, change the encoding of your terminal to UTF-8. If you can't do this, redirect the output to a file:

```
perl testff.pl >file

```

And open the file with a text editor that supports UTF-8, to see if the character is displayed correctly.

---

You want to print the character U+2881 (`⢁`), and not U+0AF1. `2881` is already in hexadecimal.

---

To get rid of the `Wide character in print` warning, set the input and output of your Perl program to UTF-8:

```
use open ':std', ':encoding(UTF-8)';

```

Instead of `use utf8;`, which only enables the interpretation of the program text as UTF-8.

---

**Summary**

Source file (`testff.pl`):

```
#!/usr/local/bin/perl
use strict;
use warnings;
use open ':std', ':encoding(UTF-8)';
print "\x{2881}";

```

Run:

```
> perl testff.pl
⢁

```