question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid component name error for valid name that uses unicode characters

See original GitHub issue

Version

2.5.16

Reproduction link

https://jsfiddle.net/50wL7mdz/536596/

Steps to reproduce

  1. register component with unicode component name. ex: my-컴포넌트
  2. use it in template. ex: <my-컴포넌트></my-컴포넌트>
  3. Vue warn is logged and component is not rendered.

What is expected?

No error, no warning. The component should be rendered properly.

What is actually happening?

The component is not rendered with this warning.

[Vue warn]: Invalid component name: “my-컴포넌트”. Component names can only contain alphanumeric characters and the hyphen, and must start with a letter.


Component-Names in Vue Guide says,

we strongly recommend following the W3C rules for custom tag names (all-lowercase, must contain a hyphen)

However, W3C rules allow lots of unicode characters for component name. I think these two rules are important:

  • They start with a lowercase ASCII letter, ensuring that the HTML parser will treat them as tags instead of as text.
  • They do not contain any uppercase ASCII letters, so user agents can always treat HTML elements ASCII-case-insensitively.

The rules prevent using uppercase ASCII letters, and does not force using only lowercase ASCII letters. They allow unicode characters, but Vue.js doesn’t accept unicode component names.

Furthermore, the error level is not error but warn, but it doesn’t work in some cases like using it as custom element in template. It works when routed by vue router.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:19
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
youngrokcommented, Aug 17, 2018

Hi, let me explain my cases. I’m working on tax reporting software in Korea. So many items are required for tax reporting, and so many terms are used in those items, and they are all Korean.

For the first time I tried to translate all the terms to English, but failed because some don’t have standard translation, some have same translation but different meaning, some have subtle difference of meaning, and so on. And it wasn’t efficient to translate all of them.

Therefore, I changed my mind to use the Korean terms as they are, and this new way works for server side and dbms perfectly. It also works for plain javascript. However, vue.js doesn’t support unicode names in some cases, so I want to make it work.

I think my case is not so rare case. Lots of developers want to use there native language in code especially when developing software that uses many complicated terms.

Technically a subset of HTML is still HTML-compliant so applying extra restrictions like this won’t break the standard.

I understand. You’re right. Then what I need is not a fix, but an improvement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid component name: "pages/product/_slug.vue ...
The reason of this error message is that the name of the _slug.vue component which is the same as the file name.
Read more >
UTN #27: Known anomalies in Unicode Character Names
In this document we list all Unicode character names with known clerical errors in the spelling of their names at the time of...
Read more >
Vue component name should be defined with valid string
This rule applies when an invalid string is used as a Vue component name. Vue component is not registered when you use invalid...
Read more >
Unsupported characters for Exchange 2013 object names
When you create names for objects or components in Exchange 2013, the names can't contain unsupported characters, even though you may be able ......
Read more >
The name can only contain underscores and alphanumeric ...
Error : The name can only contain underscores and alphanumeric characters. It must begin with a letter and be unique, and must not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found