We make tools that make websites.

Forums (Archived)

The Solspace Support Forums are now CLOSED (read-only)

Check out our new support options here. Please refer to this blog post for more information.

   

Duplicate: Some accented characters render as ‘?’ in Morsels

Avatar
Rank

Total Posts: 3

Joined: Feb 22, 2010

PM

Ignore

 

Hey there. I’m having the same exact issue that ‘mester’ had here. Some accented characters render as ‘?’ in Morsels. I’m interested in getting the patch that you gave him. Here’s my setup:

Template Morsels Module: v1.5.4
ExpressionEngine: v2.2.2
Module list / Extension list

Here’s a snippet of code from my template morsel that ins’t working.

<select id="find-country" name="country" class="styled">
    
{exp:switchee variable "{current_site}" parse="inward"}    
        {case value
="1"}
            
<option value="">Choose a country&hellip;</option>
            <
option value="US">United States</option>
            <
option value="CA">Canada</option>
            <
option value="">----------</option>
        
{/case}
        {
!-- Omitted cases 2 through 8 --}
        {case value
="9"}
            
<option value="">البلد</option>
            <
option value="US">United States</option>
            <
option value="CA">Canada</option>
            <
option value="">----------</option>
        
{/case}
        {case value
="10"}
            
<option value="">国家</option>
            <
option value="US">United States</option>
            <
option value="CA">Canada</option>
            <
option value="">----------</option>
        
{/case}
    {
/exp:switchee}
</select

The above code lets the user select which country they’re in. We’re using MSM to power twelve different versions of this site, each having their own language. The site in case 9 is Arabic and the site in case 10 is Chinese.

The first select option for each of these cases is a text label that instructs the user to select a country in the appropriate language. However, after updating and refreshing the template morsel, all Arabic and Chinese characters get turned into “?” characters. I expect the template to preserve these characters, but it does not.

I receive no errors when updating or refreshing.

It looks like you’ve created a patch for this before, so I’m requesting access to the patch (or, better yet, a permanent fix in the form of a new Template Morsels release). Thanks!

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

That patch might have already been integrated in the latest version of Template Morsels (the 1.5.3 changes seem to hint at that).

Have you tried a test morsel with only non-alphabet characters (no tag/variables) in it (for example just a morsel with “国家”)? Do you also get ??? there?

Have you also had a look at your database’s collation/character set? Are all tables set to UTF-8/Unicode? smile

Signature

Avatar
Rank

Total Posts: 3

Joined: Feb 22, 2010

PM

Ignore

 

Fixed!

I tried making another morsel with just some Chinese characters in it, and it still failed and printed out the “??” instead. After changing the encoding for the code/morsel rows (in the exp_template_morsels_cache table) to UTF-8, the Chinese/Arabic text was preserved.

Thanks for the quick reply, Nicolas.

Avatar
RankRankRankRankRank

Total Posts: 9901

Joined: Jan 8, 2009

PM

Ignore

 

My pleasure, non-alphabet characters/encodings in EE is a bit my thing wink
I’ll close the thread then, but feel free to post again if you have other questions.

Signature