简体   繁体   中英

Reading Cyrillic text from CSV / JSON with d3

I would like to import Cyrillic text from CSV or JSON using d3 (for the purpose of a bubble chart visualisation )

Once loaded with either of the functions:

d3.csv('spendings.csv', function(data) {
  console.log(data[0]);
});

or

d3.json('spendings.json', function(data) {
  console.log(data[0]);
});

the text

Многопрофилна болница за активно лечение /МБАЛ/ "Света Анна" АД - София

looks something like this in the DOM console:

M / / " " -

This tells me that the problem is not with the HTML encoding, but rather with the way Cyrillic text is read by d3.js

I use Cyrillic in D3.

1.HTML:

<head>
  <meta charset="utf-8">
</head>
  1. use utf-8 in editor .html .csv .json files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM