diff --git a/xml/impl/src/com/intellij/xml/actions/EscapeEntitiesAction.java b/xml/impl/src/com/intellij/xml/actions/EscapeEntitiesAction.java index 4dccfddd38de..9c275e856634 100644 --- a/xml/impl/src/com/intellij/xml/actions/EscapeEntitiesAction.java +++ b/xml/impl/src/com/intellij/xml/actions/EscapeEntitiesAction.java @@ -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(";"); diff --git a/xml/tests/src/com/intellij/codeInsight/editorActions/EscapeEntitiesActionTest.java b/xml/tests/src/com/intellij/codeInsight/editorActions/EscapeEntitiesActionTest.java index 9cd5a3cdb71b..e7b6bfb52453 100644 --- a/xml/tests/src/com/intellij/codeInsight/editorActions/EscapeEntitiesActionTest.java +++ b/xml/tests/src/com/intellij/codeInsight/editorActions/EscapeEntitiesActionTest.java @@ -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("", "html", ""); }