42

I want to use some strings which are in my language (Persian) in "Sublime Text", but the editor does not show them correctly, for example:

it should be:

<title>عنوان صفحه</title>

but this is how sublime is showing it:

enter image description here

The encoding is set to utf-8. What should I do to fix it?

barlop
  • 12,887
  • 8
  • 80
  • 109
MohammadHossein R
  • 1,249
  • 1
  • 16
  • 30
  • 1
    Sublime doesn't support rtl languages. And plugins can't help as we expect. You can use "Bracket" or "Notepad++" for special cases which needs persian text editing. – Morteza Aug 15 '15 at 08:00
  • You accepted an answer that doesn't work and you know it This plugin https://packagecontrol.io/packages/Bidirectional%20text%20support is very seriously flawed with (As of yet) no solution – barlop Jul 28 '16 at 12:39
  • Is there still no solution? – PurpleVermont Dec 24 '19 at 21:57

3 Answers3

8

There is This Plugin But It Does Not Work Properly

https://packagecontrol.io/packages/Bidirectional%20text%20support

added by barlop

Important Note- As comments indicate, this plugin doesn't really work. People have issues copy/pasting from sublime into notepad. It's OK for viewing but that's not much of an answer.

Note, sublime with this plugin might show leters in the correct order but copy/paste in notepad and it might not so try copy/pasting in notepad first before typing a whole load in there. Also this plugin might not move the cursor in a right to left fashion. (i.e. type a letter the cursor when typing in a right to left language should move to the left)

To install,

i've tested this on ST3 portable.

if you go to the tools menu you see there's no bidirectional option

enter image description here

Then if you go here

https://packagecontrol.io/packages/Bidirectional%20text%20support

see it mentions

their github page here

https://github.com/praveenvijayan/Sublime-Text-2-BIDI

Click on Clone/Download then download zip

enter image description here

extract it and Copy the folder to the packages folder.. i.e. open sublime, do preferences..browse packages , and it gives a folder like C:\Users\harvey\Downloads\ST3\Data\Packages Paste the folder there. (maybe it's better to put it in the user subdirectory, I don't know).

Then go to the tools menu and you see bidirectional options like bidirectional text that weren't there before

enter image description here

And while you're at it you may want to install "package control" if it's not already installed. Go to tools..command palette.. type 'package' see if package control appears. Or go to preferences, see if there is package control listed. If not then you don't have 'package control' installed. You can install package control by going to https://packagecontrol.io/ and click install and it gives you some python code in 2 tabs, one for ST2, one for ST3, and you can paste it into your console(view..console). But it's not strictly necessary you can install the bidirectional package without doing that.

barlop
  • 12,887
  • 8
  • 80
  • 109
Kukuluops
  • 119
  • 5
  • it worked :) but i have to change the font. is there any way to keep the same font for english texts and codes? – MohammadHossein R Aug 14 '15 at 10:21
  • 2
    And I found a problem. The plugin fixes the text in the editor, but when I save the file and open it with a browser, strings are messed up ! – MohammadHossein R Aug 14 '15 at 11:40
  • I didn't thought about that, because I used it to view documents not edit them. Sorry for causing a problem. As I can see, bidirectional text isn't well support in text editors. Sublime and Atom don't support it by default, but I think Notepad++ does. – Kukuluops Aug 14 '15 at 12:12
  • 1
    No, Notepad++ is pretty bad, too - highlighting is all wrong. – sq33G Jul 04 '16 at 12:23
  • This answer should not be accepted @MohammadHosseinR and you know it. You've said yourself you've found that (significant) problem – barlop Jul 28 '16 at 12:41
  • You are right. The answer is not accepted anymore. @barlop – MohammadHossein R Aug 06 '16 at 05:21
  • @barlop Did you come across a solution? – Hashim Aziz Jul 13 '21 at 13:59
  • 1
    @HashimAziz I quit using sublime afterI had an issue where I had files open on a network drive and when it couldnt access the network drive to save the file,it wiped the files. similar to what happened to this guy https://github.com/sublimehq/sublime_text/issues/3340 I lost all the files. Now I don't use sublime anymore.. I used to use it for its tabs. I often use notepad2..though it doesnt have many features. But that aside.. Many people use Atom and say its better than Sublime. And many programmers use a little free text editor by microsoft called Visual Studio Code and prefer it to Atom – barlop Jul 13 '21 at 16:54
  • @HashimAziz also I often use JGSoft editpad pro which is paid software.. basically I use various text editors but not sublime anymore! (I might consider trying sublime if I knew it didn't wipe files when it can't write.. but alternatives to sublime are either very good or perhaps even better than sublime in many ways.. though sublime does let you code your own plugins which is good, but maybe other text editors allow that too). – barlop Jul 13 '21 at 16:59
3

The RTL-Mirror plugin for sublime 3 will show you the correct text by hitting Ctrl+F1 on Windows and OSX and Shift+F1 on Linux. it's not the perefect solution but it helps.

Xavier Guihot
  • 54,987
  • 21
  • 291
  • 190
Elsiete
  • 126
  • 13
  • 2
    it might be good to view short texts but does not help in correcting typos or viewing large blocks of RTL text – vsync Mar 07 '18 at 12:20
0

For the last few years my workflow has to been use VS Code as an IDE, for coding, and Sublime Text 3 (sorry, 4) for editing plain text because of its startup speed and because VS Code would be overkill.

However, since it's pretty clear by this point that the ST devs don't intend to implement RTL support, and because I would rather not have to install a third text editor just to deal with RTL text (which there are very few of anyway), there were only two convenient options left for me to open up RTL files on Windows.


Use Windows 10's Notepad (yes, really)

This is the superior solution since the new Notepad works well, starts up faster than Sublime, and not only renders RTL text but renders it quite well. The only downside is the lack of a dark mode.


Use VS Code (or whatever your preferred IDE is)

Both free IDEs like VS Code and paid ones like PHPStorm and IntelliJ seem to support RTL out of the box, but pretty much the only good reason to do this is if you absolutely need dark mode or are not on Windows - otherwise all of them up start up far slower than Sublime, and in the case of VS Code, render RTL text worse than Notepad does (I can't speak for JetStorm IDEs on that front).

Who knows, if I find a better alternative text editor that I can move my custom theme over to I may eventually move away from Sublime completely to another editor, but until then, sticking to two editors.

Hashim Aziz
  • 4,074
  • 5
  • 38
  • 68