Bug Tracker

Modify

Ticket #6780 (closed bug: invalid)

Opened 3 years ago

Last modified 2 years ago

HTML/character entities not handled

Reported by: kbwood Owned by:
Priority: Milestone: 1.4.3
Component: attributes Version: 1.4.2
Keywords: Cc:
Blocking: Blocked by:

Description

The attr and val functions don't handle/convert HTML and character entities. For example:

$('#input').attr({title: 'søntag'}).val('søntag');

shows this exact text instead of resolving ø to ø.

Change History

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid
  • Component changed from unfiled to attributes

This seems compatible with the behavior of the underlying DOM apis, so I don't think it's a bug:

$('input')[0].value = 'søntag'; 
$('input')[0].setAttribute('title', 'søntag'); 

If you need to translate HTML entities to text, it's easy enough:

var text = $('<div />').html('s&#248;ntag').text();

comment:2 Changed 2 years ago by courtlandallen@…

Instead of using HTML entities, use unicode. For example, instead of this:

$('input').val('Click here &raquo;');

Do this:

$('input').val('Click here \u00BB');

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.