Chinese Lunar Calendar

FREEMIUM
Door copy2sim | Bijgewerkt 2달 전 | Data
Populariteit

8.6 / 10

Latency

437ms

Serviceniveau

100%

Health Check

N/A

Terug naar alle discussies

lunarDateinChinese - Chinese Characters are not displayed in the Response

Rapid account: BTRTSIT
BTRTSIT
9달 전

{“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달 전

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달 전

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);

Doe mee aan de discussie - voeg hieronder een opmerking toe

Log in / Schrij u in om nieuwe opmerkingen te plaatsen