인덱스는 0부터 시작하기 때문에 index로 들어갈 수 있는 가장 큰 수는 (문자열.legnth-1)이다. 존재하지 않는 index를 인자로 전달하면 공백이 출력됩니다.
charAt는 index에 해당하는 문자를 리턴하고,chartCodeAt은 유니코드 값을 리턴하는 차이가 있다.
예제 코드
JAVASCRIPT
charAt(index)
charCodeAt()
charCodeAt메서드는 index에 해당하는 문자의 unicode 값을 리턴합니다.
문법(Syntax)
JAVASCRIPT
string.charCodeAt(index)
Copy
인자
ndex - 필수
0보다 큰 정수
설명(description)
유니코드는 모든 시스템에서 일관되게 문자를 표현하기 위한 산업표준입니다.
charCodeAt은 주어진 index에 해당하는 유니코드 값을 리턴하는데 이 값은 unicode가 지원되는 모든 시스템에서 동일한 문자를 가르킵니다.
charAt는 index에 해당하는 문자를 리턴하고,chartCodeAt은 유니코드 값을 리턴하는 차이가 있습니다.
예제 코드
JAVASCRIPT
var stringName ='자바스크립트';console.log(stringName.charCodeAt(0));// 51088// http://www.unicode.org/charts/PDF/UAC00.pdf 에서 '자'을 찾아보면 'C790'인데 이것은 16진수다.// 이를 10진수로 변환하면 51088 된다.
Are you encountering RSS feed errors on your WordPress site?RSS feedshelp users subscribe to your blog using news reader apps like Feedly.
Since RSS feeds are published in the XML markup language, a tiny mistake in the feed can make it unreadable, and users will not be able to see new content in their news feeds.
Other apps also rely on getting content updates from your WordPress RSS feed. For example, if you useIFTTT to automate social sharingof your new posts, then that would stop working as well.
In this article, we will show you how to easily fix RSS feed errors in WordPress. We will also talk about what causes those errors and how to avoid them in the future.
WordPress outputs RSS feeds in XML which is a strict markup language. A missing line break or an extra tab can break your RSS feed.
The RSS error message will look something like this:
XML Parsing Error: XML or text declaration not at start of entity Location: http://example.com/feed Line Number 2, Column 1:
Depending on what browser you are using, your RSS feed error message may vary.
You can also see this error message when visiting your feed in a browser.
Warning: Cannot modify header information – headers already sent by (output started at /home/username/example.com/wp-content/themes/twentysixteen/functions.php:433) in /home/username/example.com/wp-includes/pluggable.php on line 1228
If you are usingFeedBurner, then your errors may look different.
Having said that, let’s take a look at what causes these RSS feed errors and how to fix them.
Manually Fixing RSS Feed Errors in WordPress
The most likely reason for your RSS feeds to show error is poor formatting. This poor formatting can be caused by a blank space after closing PHP tag in a plugin or in your theme’sfunctions.phpfile.
If you recently added a code snippet to your theme orchild theme‘s functions.php file. Then you need to edit your functions file.
If there is a closing PHP tag at the end of your functions file, then you need to make sure that there is no extra space or line breaks after it.
Ideally, the closing PHP tag is not required at the end of the file. This is why it would be best if you remove the closing php tag altogether.
This should fix the problem in most cases. However, if it does not fix your RSS feed error, then continue reading.
Disable RSS Feed Related Plugins
If you are using a WordPress plugin that modifies your website’s RSS feed or creates a new one, then you need to disable that plugin.
Next, check your RSS feed for the error. If the error disappears, then this means one of the plugins installed on your website was the culprit.
You can now reactivate your installed plugins one by one and check your RSS feed after activating each plugin. This way you will be able to find out exactly which plugin is causing the issue.
Once you have located the plugin, you can contact the plugin’s support for an update or find an alternative plugin that does the same thing.
Temporarily Switch to a Default Theme
Occasionally, a poorly coded WordPress theme function can also affect your WordPress RSS feed. To see if the problem is caused by your WordPress theme, you need to temporarily switch to a default WordPress theme.
Simply go toAppearance » Themespage and if you already have a default theme installed then activate it.
Default themes include Twenty Nineteen, Twenty Seventeen, Twenty Sixteen, and so on. If you don’t have one installed on your website, then you can click on the Add New button to install and activate it. See our guide onhow to install a WordPress themefor step by step instructions.
After switching to the default theme, check your WordPress feed for error. You can visit your feed in a browser window or test it with afeed validatortool.
If the error disappears, then this means your WordPress theme was causing the issue. You can contact the theme author for support or find a suitable new theme for your website.
When I hitany404 on your site, it goes to a hosting-supplied 404 page and not the one that should be part of your site, so it’s something related to what would be handled by htaccess. I don’t use Windows so I’m not sure if I can help.
Ok, you might have pointed me in the right direction here. On the site that works, a random 404 shows me the WordPress “page not found” page, not the hosting company 404 page.
I don’t suppose you’d be able to provide the part of .htaccess that would usually handle the /feed/ redirect? Then I might be able to figure it out.
Fixed! I took a copy of the web.config file from the working site, changed the reference to the domain in one of the RULE tags so that it referred to the correct domain, and uploaded it to the broken site. The 404 handling immediately started being done by WordPress. It took a little while for the RSS feed to sort itself out, but that’s working too now – checked via Google Chrome Feeder extension.
I haven’t copied the contents of the config file here because I’m not sure which parts, if any, might be sensitive info that could make my site vulnerable if publicly known. Although if the same file works for 2 of my sites, I guess there’s probably nothing sensitive in it…