Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS "can't set default encoding to wxFONTENCODING_DEFAULT" assert #420

Closed
hamid914 opened this issue Jul 31, 2017 · 9 comments
Closed
Labels

Comments

@hamid914
Copy link

hamid914 commented Jul 31, 2017

I got Poedit-2.0.3 on macOS Sierra 10.12.6. and it crashes after running. This error is shown when I run the program from the Application folder:

1

I run the program from the terminal and the result is:

$ /Applications/Poedit.app/Contents/MacOS/Poedit
/Users/vaclav/Development/poedit/deps/wx/src/common/fontcmn.cpp(144): assert "encoding != wxFONTENCODING_DEFAULT" failed in SetDefaultEncoding(): can't set default encoding to wxFONTENCODING_DEFAULT
Collecting stack trace information, please wait...[1]    81684 segmentation fault  /Applications/Poedit.app/Contents/MacOS/Poedit

I tried to install Poedit from HomeBrew repository:

$ brew cask install poedit
==> Satisfying dependencies
==> Downloading https://download.poedit.net/Poedit-2.0.2.zip
Already downloaded: ~/Library/Caches/Homebrew/Cask/poedit--2.0.2.zip
==> Verifying checksum for Cask poedit
==> Uninstalling Cask poedit
==> Removing App '/Applications/Poedit.app'.
==> Installing Cask poedit
==> Moving App 'Poedit.app' to '/Applications/Poedit.app'.
🍺  poedit was successfully installed!

but the result is the same.
There are two installed language on my macOS:

$ defaults read .GlobalPreferences AppleLanguages
(
    "fa-IR",
    "en-IR"
)

In my ~/.zshrc there are two lines about locale:

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

I have installed wxwidgets with HomeBrew:

$ brew install wxwidgets
==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.3.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring wxmac-3.0.3.1.sierra.bottle.tar.gz
==> Using the sandbox
🍺   /usr/local/Cellar/wxmac/3.0.3.1: 810 files, 24.3MB

But the results is the same yet.
I tried to run the program as root:

$ sudo open -a Poedit

But no luck. Then with root user and program's executable file:

$ sudo /Applications/Poedit.app/Contents/MacOS/Poedit

It "runs" now, but is it the only official way to run Poedit?!

@vslavik
Copy link
Owner

vslavik commented Aug 1, 2017

Please read this and follow the advice therein. Please also indicate where you got Poedit from.

If you have the latest official build and if this happens, then something very specific to your system is going on. It would help if you actually described your system to help identify what that something might be. E.g. your language, locale, font etc. settings are highly relevant.

@vslavik vslavik added the macOS label Aug 1, 2017
@vslavik vslavik changed the title Cannot run Poedit on macOS Sierra 10.12.6 "can't set default encoding to wxFONTENCODING_DEFAULT" macOS "can't set default encoding to wxFONTENCODING_DEFAULT" assert Aug 1, 2017
@hamid914
Copy link
Author

hamid914 commented Aug 3, 2017

I've updated my question with more details. I got my locale in my shell and did not know how to get font or wxFONTENCODING_DEFAULT settings in my shell to update my question with them. Help me how to get them.

@vslavik
Copy link
Owner

vslavik commented Aug 3, 2017

Thanks. Unfortunately running with Persian as the primary language doesn't seem to be the cause — I tried.

As for the rest: Poedit is a macOS native GUI application, so your shell settings are entirely irrelevant, so is whatever you installed with Homebrew or your shell settings.

Of course root access is not required, that's a strange question (but then, so is running the application from shell at all). This merely demonstrates that something in your user settings is triggering this. Login into a Guest account and you'll probably see everything working.

Did you previously use Poedit? Did you configure any settings in it, such as custom fonts?

@hamid914
Copy link
Author

hamid914 commented Aug 4, 2017

Thanks for your reply. No, I downloaded Poedit about a year ago and it did not work (the same problem) and I didn't try to solve it. Now, I tried version 2.0.3, 1.8.12 from the main website and HomeBrew version 2.0.2 with no sucess. And when I could run the program with root access I didn't change any settings.

  1. ✅ I tried logging in Guest account and running the program. It worked with the default settings.
  2. ✅ Then, I changed the language settings to what I had in my main account. It worked again.
  3. ✅ I opened a Terminal and run /Applications/Poedit.app/Contents/MacOS/Poedit inside it with the Guest user. It worked.
  4. ❌ Then, I changed the user with su myUsername and run it. The output was assert "encoding != wxFONTENCODING_DEFAULT" failed... again.
  5. ❌ Finally, I installed my custom Persian fonts in the Guest account, then the problem occurred again.
  6. ❌ After uninstalling all Persian fonts, the problem persisted until a logout and login.

In my main user account:

  1. ✅ I tried sudo atsutil databases -remove and then changing my languages order in Language & Region (English first). The program worked in the English localization.
  2. ✅ After that, I changed the language order (Persian first). The program worked in the Persian localization.
  3. ❌ After a logout and login, the problem is reset to its initial state. I should change my languages order in Language & Region twice to make Poedit run.
  4. ❌ Changing "Custom font" in Preferences does not have any effect on the success of running.
  • Is there any logging facility for Poedit to report my log for you?
  • And is it a design mistake in Poedit because there are absolute paths in compiled distribution binary? (I mean [censored]/wx/src/common/fontcmn.cpp(144):... in my question)

@vslavik
Copy link
Owner

vslavik commented Aug 5, 2017

sudo, paths, language, logging off are irrelevant. No need for you waste time second-guessing the code or me.

What you established as relevant is the fonts you have — and it's no coincidence that the assert message talks about fonts. The fonts (or likely, a single font) is clearly what triggers it, per your report, and seems necessary to reproducing it. Can you please attach that font (or fonts, if you don't want to waste anymore time tracking the problematic one down)? That should be enough for me to reproduce… and thus fix.

Thanks!

@hamid914
Copy link
Author

hamid914 commented Aug 5, 2017

This is the content of my ~/Library/Fonts folder:

DejaVu Sans Mono for Powerline Nerd Font Complete Mono.ttf
IRANSansWeb.ttf
IranNastaliq.ttf
ProFont IIx Nerd Font Complete Mono.ttf
Roboto-Regular.ttf
Samim-Bold.ttf
Samim.ttf
XB Niloofar.ttf
XB NiloofarBd.ttf
XB NiloofarBdIt.ttf
XB NiloofarIt.ttf
XB Titre It.ttf
XB Titre Shadow It.ttf
XB Titre Shadow.ttf
XB Titre.ttf
encodings.dir
fontawesome-webfont.ttf
fonts.dir
fonts.list
fonts.scale

And this is the compressed file of those fonts: fonts.zip

Thanks.

@vslavik
Copy link
Owner

vslavik commented Aug 7, 2017

@hamid914 I'm again asking you to read and follow the guidelines I asked you to read in my very first comment on this issue. In particular, please don't mix obviously unrelated things into a single issue: you're just making a giant unmanageable mess of it. I'm deleting your previous comment to restore some sanity to this issue. You probably corrupted permissions or files with your haphazard use of sudo: investigate, clean files, verify. If you are certain that's not it and is not transient (I'm pretty sure it is), file another issue.

Repository owner deleted a comment from hamid914 Aug 7, 2017
@vslavik
Copy link
Owner

vslavik commented Oct 11, 2017

I can't reproduce this with neither 2.0.3 nor 2.0.4, with Persian locale, so either it's gone or there's something else required to trigger it.

Are you still seeing it in 2.0.4 (the library in which this font-handling code is was updated since then)?

@vslavik
Copy link
Owner

vslavik commented Jun 6, 2020

Assuming fixed, then.

@vslavik vslavik closed this as completed Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants