0

i just open a new project in angular 2 with asp.net and I have any issue when I write in Hebrew characters, it looks like it not support when I write any letter in hebrew that's what I see enter image description here

when I write this code

 <h1>
   בדיקה בדיקה
  </h1>

photo of screen save enter image description here

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
Manspof
  • 598
  • 26
  • 81
  • 173
  • This has nothing to do with ASP.NET or Angular, everything to do with using ASCII instead of Unicode. Make sure your Hebrew text is stored as *Unicode*, not ASCII. This means that your html file should be stored as UTF8. Visual Studio stores files as UTF8 by default. – Panagiotis Kanavos Aug 16 '17 at 13:54
  • how can i check it? – Manspof Aug 16 '17 at 13:57
  • This character is the Unicode replacement character. It's used when the computer tries to convert ASCII to Unicode using a codepage that *doesn't* contain these characters. – Panagiotis Kanavos Aug 16 '17 at 13:57
  • 1
    You don't have to check it. Open the file in whatever editor you used and make sure you save it as UTF8. In Visual Studio, select Save As and in the `Save` dropdown select `Save with Encoding`. You *don't* need to specify the encoding when you create Visual Studio, UTF8 is the default. Did you create the file with a different editor perhaps? – Panagiotis Kanavos Aug 16 '17 at 13:58
  • what do you mean to save them? it's angular 2 project,i can compile and run it – Manspof Aug 16 '17 at 14:03
  • it already with utf8 and still have the issue – Manspof Aug 16 '17 at 14:03
  • No it isn't. There's no ambiguity or uncertainty about this. The Unicode replacement character appears *only* when a failed codepage conversion occurs. "An angular project" doesn't say anything about the *files*. How do you know it's UTF8 anyway? Did you check the *bytes* and found that two or more bytes are used for each Hebrew character? – Panagiotis Kanavos Aug 16 '17 at 14:07
  • Do you mean perhaps that the file has a UTF8 encoding tag? That doesn't mean it's a UTF8 file, it instructs the *browser* to display it using UTF8. If it's saved as ASCII, the browser will display it either garbled or using replacement characters. In this case, you can try changing the page's encoding from the browser's menu – Panagiotis Kanavos Aug 16 '17 at 14:08
  • I don't get you, what to do then? it's app.component.html – Manspof Aug 16 '17 at 14:09
  • Open the file in any editor. Save it with a UTF8 encoding. If you want specifics, explain which editor you use and post any encoding tags – Panagiotis Kanavos Aug 16 '17 at 14:10
  • Possible duplicate of [jQuery doesn't display Hebrew](https://stackoverflow.com/questions/10746268/jquery-doesnt-display-hebrew) – Panagiotis Kanavos Aug 16 '17 at 14:12
  • okay, i open it in notepad++, change encoding to utf-8 and insert it to the project and still have this issue – Manspof Aug 16 '17 at 14:14
  • That's not what I or vikk said. **Save** it with a UTF8 encoding, don't add the tag. The tag doesn't affect how bytes are stored on the disk. Click on `File > Save As` and change the `Encoding` combo to `UTF-8`. Then click `Save` – Panagiotis Kanavos Aug 16 '17 at 14:16
  • I don't have the option to change the encoding, when I press on save it I see only "file name" and save as type,i add photo to that – Manspof Aug 16 '17 at 14:18
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/152061/discussion-between-adir-zoari-and-panagiotis-kanavos). – Manspof Aug 16 '17 at 14:19
  • Did you try saving the file? There's no point in chatting if you don't try that *first*. This is one of the most common problems when people try working with non-English text for the first time. The solution is always the same. Make sure you **save** the file as UTF8 and *then* add the `meta` tag. – Panagiotis Kanavos Aug 16 '17 at 14:22
  • yes but when i save it, I don't see any option to choose encoding – Manspof Aug 16 '17 at 14:23
  • The screenshot is neither Visual Studio nor Notepad. What editor are you using? – Panagiotis Kanavos Aug 16 '17 at 14:23
  • I'm using visual studio code, but I just open editor notepad ++ to save it in other encoding – Manspof Aug 16 '17 at 14:24
  • Visual Studio Code allows you to change a file's encoding as well. The encoding appears in the status bar, in the lower right corner. If you click on it, you get two options - to reopen or save the file with a different encoding – Panagiotis Kanavos Aug 16 '17 at 14:25
  • where? when i press on app.component.html then save as type it shows me html files type not choose encoding – Manspof Aug 16 '17 at 14:29
  • Status bar, lower right. [Explained here](https://stackoverflow.com/a/40365121/134204) – Panagiotis Kanavos Aug 16 '17 at 14:29

2 Answers2

3

Try this solution which worked for me as suggested here

Open all your html, css, js (all client files that relevant to this project) using notepad and save them with utf-8 encoding. Notice that this might change the hebrew text and the content a little. After that you should see hebrew.

Vikhyath Maiya
  • 3,122
  • 3
  • 34
  • 68
0

I found a solution. in visual studio code choose save as to any html file, then before you press on save button you have option (when you press on the arrow in save button) save with encoding and then change it to utf 8

Manspof
  • 598
  • 26
  • 81
  • 173