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

Magento Widgets only support Latin1 charset? #5708

Closed
pantaoran opened this issue Jul 20, 2016 · 8 comments
Closed

Magento Widgets only support Latin1 charset? #5708

pantaoran opened this issue Jul 20, 2016 · 8 comments
Assignees

Comments

@pantaoran
Copy link

pantaoran commented Jul 20, 2016

I'm having trouble using Chinese titles in my widgets that I use inside static CMS pages. My Magento 2.1.0 is highly customized and I don't really have time to install a stock version right now, so I'm reporting this anyway, hoping that someone could try and reproduce it since the steps are very simple.

The real problem that I have is more complex than this, but let's start here.

Steps to reproduce

  1. Install Magento from 2.1.0 branch.
  2. Login to backend, navigate to Content -> Pages
  3. Open an existing CMS page (or create a new one)
  4. Make sure the TinyMCE editor is showing
  5. Insert a widget with a customizable text field, for example "Catalog Category Link"
  6. Set the "Anchor Custom Title" to "中文"
  7. Toggle "Show / Hide editor" to display raw source

Expected result

Chinese characters
{{widget type="Magento\Catalog\Block\Category\Widget\Link" anchor_text="hello" title="中文��" template="category/widget/link/link_inline.phtml" id_path="category/5"}}
(Apparently github also has some issue displaying this correctly here?)

Actual result

Garbled Latin1 characters
{{widget type="Magento\Catalog\Block\Category\Widget\Link" anchor_text="hello" title="中�" template="category/widget/link/link_inline.phtml" id_path="category/5"}}

@pantaoran
Copy link
Author

pantaoran commented Jul 20, 2016

I then thought that I could easily enough work around that by inserting the Chinese characters in the source view and not using the editor view. That works at first, and when I save the page I can see the correct result on the frontend.

However, the next time I open the page content in the backend, I get an error popup saying

Attention error: error in [unknown object].fireEvent(): event name: tinymceBeforeSetContent error message: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.

Now when I look at the content, my images on the same page are broken (part of their code is missing) as follows:

Expected:

src="{{media url="wysiwyg/homepage/homepage-3.jpg"}}"

Actual:

src="{{media url="

@adragus-inviqa
Copy link
Contributor

/cc #3860 #4232

@pantaoran
Copy link
Author

Ah yes, looks like #4232 is pretty much the same issue.

@pantaoran
Copy link
Author

This is a very serious problem for us, because due to this we cannot allow our client to edit the home page of their own website since they would inevitably break it. This is hard to explain to our clients.

@tkacheva
Copy link

tkacheva commented Jul 27, 2016

@pantaoran Issue is fixed in 54df23a. I checked it's not reproachable any more.
coding

@pantaoran
Copy link
Author

Sorry but I cannot confirm this.

I made the changes from the commit that you pointed to:

The problem that I described in my first post here is not fixed. If I add Chinese to the widget I still end up with meaningless Latin characters instead.

The problem described in my second post is also not fixed: if I add Chinese to the source without using the wysiwyg and save it still breaks my page like I described.

@andimov
Copy link
Contributor

andimov commented Aug 2, 2016

@pantaoran
Thanks for reporting!
This is a duplicate issue. I'm closing this one. Please feel free to reopen if you need.

@andimov andimov closed this as completed Aug 2, 2016
@pantaoran
Copy link
Author

I'm going to reference two pull requests that could be related to this:
#8130
#5548

slavvka pushed a commit that referenced this issue May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants