Issue Details (XML | Word | Printable)

Key: MDL-6688
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: David Mudrak
Reporter: Nicolas Martignoni
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

UTF-8 non breaking spaces in language packs cause display problems

Created: 25/Sep/06 09:58 PM   Updated: 02/Nov/08 08:29 PM
Return to search
Component/s: General, Languages
Affects Version/s: 1.6
Fix Version/s: 1.8.1, 1.9

Issue Links:
Relates
 

Participants: David Mudrak, Michael Blake and Nicolas Martignoni
Security Level: None
QA Assignee: Nicolas Martignoni
Affected Branches: MOODLE_16_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE

Sub-Tasks  All   Open   
 Sub-Task Progress: 
No sub-tasks match this view.

 Description  « Hide
If the language pack contains UTF-8 encoded non breaking spaces, some strings display wrong.

To reproduce, follow these steps:
1) Switch to the french language.
2) Log in and see "Connecté sous le nom « Your Name Here »" in the top right of the window (correct behaviour).
3) Log out
4) In the file moodle.php of the french language pack, replace the   in the string $string['loggedinas'] with a UTF8 encoded non breaking space.
5) Log in and see the "Connecté sous le nom «" (nothing more) in the top right of the window (bug).

The correction of this bug could be very handful, as it will allow a better lisibility of the lang pack and the consistent use of non-breaking spaces in all strings (i.e also those that are sent by standard mail, which doesn't support HTML entities).

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Michael Blake added a comment - 27/Sep/06 02:24 PM
Only need to specify the first version in which the problem was found.

Nicolas Martignoni added a comment - 16/Oct/06 12:12 AM
Display problems in Javascript warning popups, as they don't interpret   entities.

Nicolas Martignoni added a comment - 04/Feb/07 07:42 PM
To workaround this bug, I removed all the UTF8 non breaking spaces from the french lang pack, so this doesn't seem to be reproducible.

David Mudrak added a comment - 11/Feb/07 06:05 AM
Would automatic removing of all UTF8 non breaking spaces during the file save acceptable?

Nicolas Martignoni added a comment - 11/Feb/07 08:51 PM
No, because:

1) The non-breaking spaces ARE important (at least in french), so we shouldn't remove them, but instead replace them with   HTML entities (I meant this in my preceding comment, sorry for the bad explanation) during the file save. Note that as of 1.8dev, the file save strips these   entities, which is bad (and I should perhaps open another bug issue for this one).

2) Some translator (me ), for efficiency, doesn't use the Moodle interface to translate the strings. The conversion described in the above point would be for them of no use.

If it was feasible, I would suggest to workaround the lacking UTF-8 support of the sprintf() PHP function used in get_string_from_file() (in lib/moodlelib.php). This way, we could write the strings in UTF-8 without any doubts.

See for a suggested solution here : http://www.php.net/manual/en/function.sprintf.php#55837


David Mudrak added a comment - 13/Feb/07 07:10 AM
I see know - I am sorry for misunderstanding. After today's playing with lang.php, I have created two subtask for this issue. The first patch will be quite easy - at my notebook, Moodle is already keeping   and   as a part of translated string. However, I would like to save this nb-space in pure Unicode in .php files and not as HTML entity.

But, I am still having problem with direct typing Alt+0160 or copying a nbsp from other sources (text files, emails etc.). Maybe the problem is only with my browser. I need you assistance - can you please check MDL-8500, download the published script, try it at your server/browser and report the result, please?

Thank you.


David Mudrak added a comment - 08/Apr/07 02:44 AM
Partially fixed: lang.php preserves   entities.