THE Kagaya Hotel in Japan’s Ishikawa prefecture is a prestigious ryokan, a traditional Japanese inn. Its sole overseas branch is a joint venture in Taipei, the capital of Taiwan. When it opened more than four years ago the website blazed with black-and-white photographs from the time when Japan was an occupying power on the island, from 1895 to 1945. Taiwanese guests were urged to “reconnect with distant memories”. These days maids at the hotel are Taiwanese and serve a mainly Taiwanese clientele. But they wear kimonos and study a rigorous course of Japanese language and etiquette—down to the notion that stepping on the border between two tatami mats brings bad luck.

By contrast China and Korea harbour only the bitterest memories of Japan’s wartime atrocities. While the people of Taiwan have not forgotten that history, their recollections tend to emphasise what the Japanese did to modernise their island (like building the first iron-and-concrete Taipei bridge, pictured above, in 1925).

Taiwan combines its abiding fondness for Japan with a knack for doing business with mainland China. The president, Ma Ying-jeou, has identified Taiwan’s unique cultural triangulation between Japan and China as a means to bring in more business. Taiwan and Japan signed an investment-protection accord in 2011 and in 2013 they drew up several bilateral pacts governing industrial co-operation. Three science parks in southern Taiwan have set aside areas exclusively for Japanese firms.

The strength of the relationship—and commercial weakness at home—is tempting more Japanese companies to regard Taiwan and its 23m consumers as a bolthole: from lacklustre domestic markets into the robust economies of greater China. While Shinzo Abe, Japan’s prime minister, struggles to end his country’s economic slump with the “three arrows” of monetary easing, fiscal stimulus and reform, Japanese firms are turning abroad, ploughing funds into 618 new ventures in Taiwan in 2013 alone, more than Taiwan attracted from any other country and nearly double the number Japan made just three years earlier. (Restrictions severely limit the flow of investment from the mainland to Taiwan.) Japanese and Taiwanese firms are teaming up to sells goods in mainland China and the rest of the world too.

The number of Japanese investments was record-beating, but their diversity was even more remarkable. The total amount of Japanese FDI in Taiwan was $409m in 2013, which made Japan the island’s the fourth-largest source; at this stage it is mainly small- and medium-sized enterprises (SMEs) that are looking to go abroad. The bigger Japanese conglomerates had already sailed in pursuit of favourable headwinds. The new fleet of Japanese businesses entering Taiwan range from small ramen shops to mid-sized construction firms. In the first ten months of 2014 Japanese business made 393 new investments in Taiwan, even as Japan was slipping into recession.

Taiwan’s commercial ties to Japan have been strong throughout the post-war era, but the country's sometimes kitschy nostalgia for Japanese culture first came into flower with the lifting of martial law in 1987 and the advent of democracy. It may have been accentuated by the nasty legacy left by Chiang Kai-shek’s Kuomintang (KMT), who succeeded Japanese colonists. Chiang’s clique had excoriated the Japanese for their crimes in wartime, but many ordinary Taiwanese were equally appalled by the KMT’s massacre of their own countrymen in February 1947, when as many as 20,000 were killed. The Taiwanese who lived on the island before Chiang’s arrival reckon that his KMT were just as bad—or worse—than the Japanese colonists.

Japanese companies also find it helpful that thousands of Taiwanese have experience living and working in mainland China, and speak its languages fluently. Anti-Japanese sentiment in China is simmering, fuelled by disputes over islands in the East China Sea. Mr Abe, a conservative nationalist, has not managed to defuse this. Ventures in China involving Japanese FDI often fail, notes Kenji Okuda, a partner with PricewaterhouseCoopers Taiwan. Japan’s SMEs often find the prospect of crossing the East China Sea to be daunting. They “think they have no ability or no capacity to directly invest in China,” Mr Okuda says.

As a result, many Japanese firms pair up with Taiwanese companies to enter the China market together. There are now partnerships in all sorts of business, Taiwanese officials say, ranging from the treatment of pancreatic cancer to the manufacture of electronic components. In 2009 Kikkoman Corporation, a famous Japanese soy-sauce maker, teamed up with Uni-President Enterprises Corporation of Taiwan to sell soy sauce adapted to Chinese tastes.

Yuichi Ochi, the general manager of Capcom Taiwan, a subsidiary of a prominent Japanese video-game maker, says his company handles the majority of Capcom’s Chinese business, most of it in game-licensing. He says his Taiwanese staff have a much greater understanding of Chinese business practices than their colleagues in Japan do. James Liu, the president of Syscom Computer Engineering, a Taiwan-based systems firm, notes that Japan’s large software industry has stuck mainly to its domestic market. His company tries to help these Japanese firms take advantage of its networks in China and beyond.

Taiwan’s policy of triangulation seems likely to continue. Its independence-leaning Democratic Progressive Party (DPP) recently won landslide victories in municipal elections, making it hopeful about presidential elections in 2016. Conventional wisdom says that DPP rule would worsen the old tensions with China, but it now seems unlikely that anything in the unique cross-Strait business relationship would change much. Taiwanese companies have been known to bend the rules when it comes to doing business with China, whatever the political climate. And the DPP’s supporters tend to feel more warmly about Japan than the KMT’s. So a change of government in Taiwan could bring the country even closer to Japan.