How to Scrape Japanese Websites Correctly: Encodings, Text and Polite Crawling

· Updated:

To scrape Japanese websites correctly, decode each page with the encoding it actually uses (UTF-8, Shift_JIS or EUC-JP), normalize full-width characters before you parse numbers, and collect only public data at a polite pace after checking robots.txt and the site's terms. Most garbled output (mojibake) comes from decoding Shift_JIS or EUC-JP as UTF-8 or Latin-1. This guide explains the Japanese specifics and gives a runnable Python example that handles them.

Japanese IPv4 with unmetered traffic for polite crawls

What makes it different to scrape Japanese websites

Three things trip up crawlers built for English sites. First, encodings: modern Japanese sites mostly use UTF-8, but many older shops, forums, government pages and long-running catalogs still serve Shift_JIS (often really Windows-31J, also called CP932) or EUC-JP. Second, text: Japanese mixes full-width and half-width characters, so the price ¥1,980 and ¥1,980 are the same number written two ways. Third, rules: Japanese copyright and personal data law apply to what you collect and keep.

None of this needs a special framework. It needs careful decoding, a normalization step and a crawler that behaves well.

Decoding Shift_JIS and EUC-JP in Python

Python's requests guesses response.text from the HTTP header. When a Japanese server sends text/html without a charset, the guess can be wrong, and you get mojibake. The fix is to decode response.content (raw bytes) yourself:

  • Read the charset from the header, then from the <meta charset> tag in the first few kilobytes if the header has none.
  • Map Shift_JIS names to `cp932`. Sites labelled Shift_JIS often use Windows extensions such as circled numbers (①) and some kanji that strict shift_jis cannot decode; cp932 handles them.
  • Use `euc_jp` for EUC-JP pages. It is common on older Unix-built sites and some long-running services.
  • Decode with `errors="replace"` so one bad byte does not crash a run, and log pages where replacements appear.

When the declared encoding is wrong

Sometimes a page declares one encoding and uses another, often after a CMS migration or on pages assembled from older templates. A quick test catches it: count the replacement characters (U+FFFD) after decoding. If a page labelled UTF-8 is full of them, try cp932 and euc_jp on the same bytes and keep the result with the fewest replacements. Log those URLs, because the same template usually affects a whole section of the site.

Normalizing full-width text

After decoding, run unicodedata.normalize("NFKC", text) on fields you parse. NFKC turns full-width digits and letters (123, ABC) into ASCII and half-width katakana into full-width katakana, so prices, model numbers and postal codes compare correctly. Keep the original text too if you display it, because NFKC also changes some symbols.

Japanese numbers, prices and dates

Consumer prices in Japan are shown including consumption tax (総額表示), sometimes with the pre-tax amount alongside as 税抜. Large amounts can use 万 (10,000), as in 1.5万円. Dates may use the Japanese era (令和7年 is 2025). Write explicit parsers for these instead of hoping a generic library guesses.

A runnable Japanese scraper in Python

The example below fetches a short list of pages through a Japanese proxy. It checks robots.txt with the same session, detects Shift_JIS or EUC-JP from the header or meta tag, decodes the raw bytes, normalizes the title with NFKC, stops on 403, 429 or 503 instead of retrying harder, and waits between requests. All requests have timeouts.

# pip install requests beautifulsoup4
import codecs, re, time, unicodedata
from urllib.parse import urljoin, urlsplit
from urllib.robotparser import RobotFileParser
import requests
from bs4 import BeautifulSoup

PROXY = "http://USER:PASS@IP:PORT"
S = requests.Session()
S.proxies = {"http": PROXY, "https": PROXY}
S.headers.update({"User-Agent": "example-research-bot/1.0 ([email protected])",
                  "Accept-Language": "ja,en;q=0.5"})

SJIS = {"shift_jis", "shift-jis", "sjis", "x-sjis", "windows-31j", "ms_kanji", "cp932"}
EUC = {"euc-jp", "eucjp", "x-euc-jp", "euc_jp"}

def page_encoding(resp):
    m = re.search(r"charset=[\"']?([\w-]+)", resp.headers.get("Content-Type", ""), re.I)
    name = m.group(1) if m else None
    if not name:
        m = re.search(rb"<meta[^>]+charset=[\"']?([\w-]+)", resp.content[:4096], re.I)
        name = m.group(1).decode("ascii") if m else "utf-8"
    name = name.lower()
    if name in SJIS:
        return "cp932"      # Windows-31J: superset of Shift_JIS used by most sites
    if name in EUC:
        return "euc_jp"
    try:
        return codecs.lookup(name).name
    except LookupError:
        return "utf-8"

def allowed(url):
    root = "{0.scheme}://{0.netloc}".format(urlsplit(url))
    rp = RobotFileParser()
    r = S.get(urljoin(root, "/robots.txt"), timeout=15)
    rp.parse(r.text.splitlines() if r.ok else [])
    return rp.can_fetch(S.headers["User-Agent"], url)

def fetch(url):
    if not allowed(url):
        print("robots.txt disallows", url); return None
    r = S.get(url, timeout=(10, 30))
    if r.status_code in (403, 429, 503):
        print("server asked us to stop:", r.status_code); return None
    r.raise_for_status()
    html = r.content.decode(page_encoding(r), errors="replace")
    soup = BeautifulSoup(html, "html.parser")
    title = soup.title.get_text(strip=True) if soup.title else ""
    return unicodedata.normalize("NFKC", title)  # full-width -> half-width digits

for url in ["https://www.example.jp/catalog/1", "https://www.example.jp/catalog/2"]:
    print(url, fetch(url))
    time.sleep(10)  # polite pace

Replace the example URLs with pages you are allowed to collect, and set a real contact address in the User-Agent so site owners can reach you. The Python requests proxy guide covers proxy syntax and SOCKS5 variants.

Polite crawling and Japanese law

Check for an official API or data feed first; many Japanese services, from e-commerce platforms to public agencies, publish one. If you crawl, keep the rate low, honor robots.txt and the site's terms, cache what you have already fetched, and stop when the server tells you to. Never answer a 429 or a block by switching IPs.

Japan's Copyright Act includes provisions on using works for information analysis, but they have limits and conditions, and they do not override a site's terms or other laws. The Act on the Protection of Personal Information (APPI) covers names, contact details and other personal data, so leave them out unless you have a lawful basis. Japan's Unauthorized Computer Access law prohibits getting around access controls such as logins. This is general information, not legal advice; for a broader view see is web scraping with proxies legal.

When a Japanese IP fits your crawler, and when it does not

Some Japanese sites show different content, prices or stock to visitors in Japan, or serve their domestic catalog only to Japanese addresses. For a polite, scheduled crawl of that public content, a fixed Japanese IP keeps results consistent. ProxyV4 sells private Japan IPv4 proxies: private datacenter IPv4 addresses in Japan, one tenant per IP for the whole term, the same IP while active and on renewal before expiry.

Every proxy supports HTTP(S) and SOCKS5, with username and password login by default; IP whitelist login is also offered on the order page for up to 3 public IPv4 addresses, which suits a crawler server. Traffic is unmetered, so you pay per IP per month in USD rather than per gigabyte, with 1, 3, 12 or custom terms and lower per-IP prices at higher quantities. See live prices and start with a single IP.

Where it does not fit: a datacenter IP is not a way to get past rate limits, CAPTCHAs or blocks, and ProxyV4 does not sell rotating pools for that. If a site does not want to be crawled, the answer is its API or permission, not more IPs. In Japan, ProxyV4 sells private datacenter IPv4 and static ISP. For the broader use case, see web scraping proxies and the Japan proxy page.

Frequently asked questions

How do I decode Shift_JIS in Python?

Decode the raw bytes with response.content.decode("cp932", errors="replace"). CP932 covers the Windows extensions most Shift_JIS sites use.

How do I handle EUC-JP with requests?

Detect the charset from the header or meta tag and decode response.content with euc_jp instead of trusting response.text.

Why do Japanese numbers fail to parse?

They are often full-width characters. Normalize with NFKC before parsing, and handle 万 and era dates explicitly.

Should I switch IPs when a Japanese site returns 429?

No. A 429 means slow down. Back off, reduce the rate, or ask the site for API access.

Does crawling cost extra traffic fees on ProxyV4?

No. Traffic on private IPv4 is unmetered; you pay per IP per month.

Sources

Japanese IPv4 with unmetered traffic for polite crawls

Run scheduled, polite crawls of public Japanese pages from one private Japan IPv4 address. HTTP(S) and SOCKS5, the same IP on renewal, no per-GB billing.

See Japan prices

Related articles

Proxies by platform
Proxies for web scraping: a fixed pool of IPs with unmetered traffic
Web scraping proxies for Python, Scrapy, Playwright and Selenium: a pool of private IPv4 and static ISP addresses, unlimited bandwidth, flat per-IP pricing.
Proxies by country
Japan Proxies: A Private Japanese IP for Sourcing, Research and Play
Buy a Japan proxy: a static Japanese IP only you use, private IPv4 for Rakuten and google.co.jp research or static ISP for Japanese accounts you keep.
Proxy setup
Python requests through an authenticated proxy, step by step
Send Python requests through an authenticated HTTP(S) proxy: build the proxies dict, attach it to a Session, encode odd passwords, rotate a list, check the IP.
Knowledge base
How to Retry with Backoff in a Web Scraper
Retry with backoff when scraping: which errors to retry, honoring Retry-After on 429 and 503, exponential backoff with jitter, and a per-host circuit breaker.
IPV4 · japan
Japan Private IPv4 Proxy for Sourcing, Price Watching and Ad Checks
Japan private IPv4 proxy with one dedicated, static Japanese IP per customer for Mercari and Rakuten sourcing, Yahoo! JAPAN rank checks and LINE ad previews.
Knowledge base
Japan SOCKS5 Proxy: How to Set It Up and Use It Properly
Japan SOCKS5 proxy setup: socks5 vs socks5h remote DNS, username/password or IP whitelist login, and tested curl and Python examples with a Japanese IP.
Knowledge base
Japanese Keyword Research From Abroad: Tools, Suggestions and Script Variants
Japanese keyword research from abroad: use Keyword Planner and Yahoo! Ads tools, read google.co.jp and Yahoo! JAPAN suggestions from Japan, and group variants.
Knowledge base
How to Get a Japanese IP Address from Outside Japan
How to get a Japanese IP address: VPN, Tokyo cloud server or static proxy compared, how Japanese sites geolocate you, and setup for Chrome and the command line.
Free tools
Check proxies in bulk: status, exit IP and latency
Free online proxy checker: paste up to 100 ip:port:user:pass lines and see which proxies work, their exit IP and latency, plus what each failure result means.
Products
Dedicated datacenter proxies: one private IPv4 per customer
Private IPv4 proxies in the US, Vietnam, Japan, South Korea, Singapore, the UK and Hong Kong. One tenant per IP, HTTP(S) and SOCKS5, no traffic metering.