Chinese Lunar Calendar

FREEMIUM
От copy2sim | Обновлено 2 months ago | Data
Популярность

8.7 / 10

Задержка

449ms

Уровень обслуживания

100%

Health Check

N/A

Назад ко всем обсуждениям

lunarDateinChinese - Chinese Characters are not displayed in the Response

Rapid account: BTRTSIT
BTRTSIT
9 months ago

{“solarDate”: {“solarDay”: 2, “solarMonth”: 7, “solarYear”: 2020}, “lunarDate”: {“isleap”: 0, “lunarDay”: 12, “lunarMonth”: 5, “lunarYear”: 2020}, “lunarDateinChinese”: “\u4e94\u6708\u5341\u4e8c”, “sexagenaryCycle”: “\u5e9a\u5b50”, “solarTerm”: “”, “solarTerminEnglish”: “”, “festival”: “”, “chineseZodiacSign”: “\u9f20”, “chineseZodiacSigninEnglish”: “Rat”, “westernZodiacSign”: “\u5de8\u87f9\u5ea7”, “westernZodiacSigninEnglish”: “Cancer”}

lunarDateinChinese

Rapid account: Copy 2 Sim
copy2sim Commented 9 months ago

The value of lunarDateinChinese, in this case, is represented in Unicode as “\u4e94\u6708\u5341\u4e8c”. To convert it into Chinese characters, you can utilize the following JavaScript code:

<script>
function convertUnicodeToChinese(unicode) {
var codeArray = unicode.split("\u");
var chinese = “”;

for (var i = 0; i < codeArray.length; i++) {
var code = codeArray[i];
if (code) {
chinese += String.fromCharCode(parseInt(code, 16));
}
}

return chinese;
}
// Example usage
var unicode = “\u4e94\u6708\u5341\u4e8c”; // Unicode representation of "五月十二"
var chineseText = convertUnicodeToChinese(unicode);
console.log(chineseText);
</script>

Rapid account: BTRTSIT
BTRTSIT Commented 9 months ago

xhr.open(‘GET’, ‘https://chinese-lunar-calendar.p.rapidapi.com/?date=’ + ConvertedDate + ‘&timezone=480&simplified=1’);
xhr.setRequestHeader(‘X-RapidAPI-Key’, ‘’);
xhr.setRequestHeader(‘X-RapidAPI-Host’, ‘chinese-lunar-calendar.p.rapidapi.com’);
xhr.setRequestHeader(‘OData-MaxVersion’, ‘4.0’);
xhr.setRequestHeader(‘OData-Version’, ‘4.0’);
xhr.setRequestHeader(‘Accept’, ‘application/json’);
xhr.setRequestHeader(‘Content-Type’, ‘application/json; charset=utf-8’);
xhr.onreadystatechange = function () {
if (this.readyState === 4) {
xhr.onreadystatechange = null;
if (this.status === 200) {
var result = JSON.parse(this.response);
//json.decode(utf8.decode(response.bodyBytes));

			var gmb_namechinese = result['lunarDateinChinese'];
			return gmb_namechinese;
		}
		else { }
	}
};
xhr.send(data);

Присоединяйтесь к обсуждению – добавьте комментарий ниже:

Войдите / Зарегистрируйтесь, чтобы публиковать новые комментарии