Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Unable to create a page with japanees character in CQ5.6.1

Avatar

Level 4

Hi,

I am working on japanees project where everything in japanees including page name.

If i create any page in siteadmin all japanees characters replaced by underscore(_) but i can create a node in japanees in CRXDE lite.

I tried to create a node programmatically but it doesn;t work.

Any help will be highly appreciated.

Thanks in advance.

Vikram.

1 Accepted Solution

Avatar

Correct answer by
Employee

Hello Vikram,

You are trying to create node names using Japanese characters? AEM is RESTful, and its resources should be referable by a URI. URIs are limited to the ASCII characters or escaped sequences [1]. The characters allowed as item names in a JCR are different [2].

I am supposing you want to create a node in the repository like this:

|- content
      |- はい

Names with high byte characters are allowed in the JCR spec. You can do this. Characters must be ASCII, UTF-8 or UTF-16. Item names cannot contain '/' | ':' | '[' | ']' | '|' | '*'

CRXDE Lite uses UTF-8 and creates the node RESTFully using a POST request, with the name specified in a parameter. Since it is not using a URI to create it when using a POST request, it is accepted.

Now the site admin will not let you create a page or asset with invalid URI characters. Content created there is supposed to be accessible via URI. You are going to access it through a web server, after all. It will not let you do that because it is protecting you from yourself.

For that reason, the node NAME must be ASCII for pages and assets in the DAM and other content to be served such as CSS and JS. You can give the page a Japanese TITLE, however. See the Geometrixx Chinese example at http://localhost:4502/cf#/content/geometrixx/zh.html 

The reason you may not be able to programmatically create a node is that Java is agnostic and sort of ignorant of character encoding. It will take whatever you give it. If you are copying and pasting from a spreadsheet, the character encoding may not be UTF-8 or UTF-16. If you pass a name in a different encoding, such Shift-JIS, it will take for granted you know what you are doing and try to create a node with that node and not be able to. It is not UTF-8 or UTF-16. Make sure you save your content as UTF-8 or UTF-16 before copying and pasting. If you are using an IDE like Eclipse, make sure the character encoding is set to save as UTF-8 or UTF-16.

Let me know if that helps.

Deke

 

 

[1] https://www.ietf.org/rfc/rfc1738.txt

[2] http://www.day.com/specs/jcr/2.0/3_Repository_Model.html

View solution in original post

4 Replies

Avatar

Level 10

AEM supports Japanese out of the box. if you are finding difficulty in creating programmatically, please do check UTF-8 encoding and decoding.

Avatar

Correct answer by
Employee

Hello Vikram,

You are trying to create node names using Japanese characters? AEM is RESTful, and its resources should be referable by a URI. URIs are limited to the ASCII characters or escaped sequences [1]. The characters allowed as item names in a JCR are different [2].

I am supposing you want to create a node in the repository like this:

|- content
      |- はい

Names with high byte characters are allowed in the JCR spec. You can do this. Characters must be ASCII, UTF-8 or UTF-16. Item names cannot contain '/' | ':' | '[' | ']' | '|' | '*'

CRXDE Lite uses UTF-8 and creates the node RESTFully using a POST request, with the name specified in a parameter. Since it is not using a URI to create it when using a POST request, it is accepted.

Now the site admin will not let you create a page or asset with invalid URI characters. Content created there is supposed to be accessible via URI. You are going to access it through a web server, after all. It will not let you do that because it is protecting you from yourself.

For that reason, the node NAME must be ASCII for pages and assets in the DAM and other content to be served such as CSS and JS. You can give the page a Japanese TITLE, however. See the Geometrixx Chinese example at http://localhost:4502/cf#/content/geometrixx/zh.html 

The reason you may not be able to programmatically create a node is that Java is agnostic and sort of ignorant of character encoding. It will take whatever you give it. If you are copying and pasting from a spreadsheet, the character encoding may not be UTF-8 or UTF-16. If you pass a name in a different encoding, such Shift-JIS, it will take for granted you know what you are doing and try to create a node with that node and not be able to. It is not UTF-8 or UTF-16. Make sure you save your content as UTF-8 or UTF-16 before copying and pasting. If you are using an IDE like Eclipse, make sure the character encoding is set to save as UTF-8 or UTF-16.

Let me know if that helps.

Deke

 

 

[1] https://www.ietf.org/rfc/rfc1738.txt

[2] http://www.day.com/specs/jcr/2.0/3_Repository_Model.html

Avatar

Level 4

Thanks for your reply.

I am reading japanese characters from Excel (2010) using apache POI. Excel seems doesn't support UTF-8.

If i print the readed value from excel it works. If i create a node using that japanese character it doesn't work.

Any idea.

Avatar

Level 4

Hi Deke,

Thanks for your suggestions. I'll try and let you know.

Thanks.

Vikram.