mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix escaping for chars in (127, 255]
This commit is contained in:
@@ -79,7 +79,7 @@ public class EscapeEntitiesAction extends SimpleCodeInsightAction {
|
||||
char c = text.charAt(i);
|
||||
final PsiElement element = file.findElementAt(start + i);
|
||||
if (element != null && isCharacterElement(element)) {
|
||||
if (c == '<' || c == '>' || c == '&' || c == '"' || c == '\'' || c > 0xff) {
|
||||
if (c == '<' || c == '>' || c == '&' || c == '"' || c == '\'' || c > 0x7f) {
|
||||
final String escape = ESCAPES.getValue(file).get(c);
|
||||
if (escape != null) {
|
||||
result.append("&").append(escape).append(";");
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
*/
|
||||
public class EscapeEntitiesActionTest extends LightCodeInsightFixtureTestCase {
|
||||
private static final String NDASH = new String(new byte[]{-30, -128, -109}, CharsetToolkit.UTF8_CHARSET);
|
||||
private static final String COPY = new String(new byte[]{-62, -82}, CharsetToolkit.UTF8_CHARSET);
|
||||
|
||||
public void testSimpleHtml() {
|
||||
doTest("<<<", "html", "<<<");
|
||||
@@ -32,10 +33,14 @@ public class EscapeEntitiesActionTest extends LightCodeInsightFixtureTestCase {
|
||||
doTest(">>>", "xml", ">>>");
|
||||
}
|
||||
|
||||
public void testWide() {
|
||||
public void testVeryWide() {
|
||||
doTest(NDASH, "html", "–");
|
||||
}
|
||||
|
||||
public void testWide() {
|
||||
doTest(COPY, "html", "®");
|
||||
}
|
||||
|
||||
public void testAttributeValue() {
|
||||
doTest("<a alt='" + NDASH + "'></a>", "html", "<a alt='–'></a>");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user