Comments (3)
I made a new user called "Unicodeグ" but can't reproduce the issue. The game starts fine and FMs run fine for me even using that account. But your fix does no harm either, so I guess I'll accept it.
Feel free to clean up the stub. I freely admit I know little to nothing about C++ and I wrote it by googling for documentation, doing what the static analyzer suggested, and just kind of bumbling through until it worked. If you feel you can make some more improvements then by all means!
I think the problem with fopen was probably that originally I was accidentally writing the temp file with UTF8 BOM (so it had the FEFF bytes at the beginning) and it didn't like that. I remember something about garbage characters at the start so maybe that was it. I could be wrong. Honestly I don't care that much as long as what's there now works, but if you wanna try your hand then be my guest.
Regarding passing the data in an environment variable, I stay well away from that due to this sort of thing:
https://devblogs.microsoft.com/oldnewthing/20100203-00/?p=15083
Sure, we probably wouldn't hit any limits, but I just don't like how janky it all is. Using a temp file may not be a refined solution, but it works well in my experience (unless we have a bug like this of course).
from angelloader.
I knew of the environment variable limit but I've assumed it'd be generous enough for your needs or that you could use more than one and use one variable for each value you need instead of parsing a file yourself. Nevermind it if you are not interested.
Also my PR uses the non-standard wide char std::ifstream
constructor, which is Microsoft specific addition (I'm not sure how available it is on other compilers on Windows), but I assume MSVC is (for now?) the only compiler you care about.
I'm not sure what can cause your system to not produce the exception. I'm guessing you have somehow globally set your default Windows codepage to 65001 which is UTF-8 or made other changes in your registry (which I am afraid to test in case it bricks my Windows install). On modern Windows 10 versions there was a lot of work done by Microsoft to support UTF-8 for filenames, char *
APIs, etc.
Here's a test program with a string (グąáüñж汉한ẞשָׁї́
) containing characters from many non-ASCII languages. For me it prints "1252" and "No mapping for the Unicode character exists in the target multi-byte code page." (this is the exception message).
The 1252 is codepage https://en.wikipedia.org/wiki/Windows-1252 , and if I use only characters from it (accents, ñ, umlauts, etc.) it does convert the string properly.
If you want to verify it then you could try Angel Loader with non-ASCII username or this test program on a freshly created VM of Windows 7, 8 or 10. I did try on a VM of 10 yesterday, but I was doing something wrong with setting up Thief and didn't have time to try again yet. If you want to find codepoints of given characters you can use my website: https://frex.github.io/unicode.html
#include <Windows.h>
#include <filesystem>
#include <stdexcept>
#include <iostream>
#include <string>
int main(void)
{
const wchar_t w[] = {
L'a', 0x30B0, 0x105, 0xE1, 0xFC, 0xF1, 0x436, 0x6C49, 0xD55C,
0x1E9E, 0x5E9, 0x5B8, 0x5C1, 0x457, 0x301, L'b', L'\0'
};
std::cout << GetACP() << std::endl;
std::filesystem::path x(w);
try {
std::cout << x.string() << std::endl;
}
catch(const std::exception& e) {
std::cerr << e.what() << std::endl;
}
}
from angelloader.
I've closed it since the fix PR was merged. If I ever improve the stub I'll make another PR and issue.
from angelloader.
Related Issues (20)
- Request: GUI optimization, move sidebar to the bottom, move Scan all FMs, Settings & Import from to Main menu HOT 4
- Move infrequently used buttons into main menu
- On refreshing the FMs list when new ones are added
- Allow game icons/tabs to be hidden if the game isn't installed
- See if we can color the title bar ourselves to bring it in line with dark theme HOT 2
- Zip extraction failed fully or partially. HOT 4
- Dark theme is not (fully) applied in RTF READMEs HOT 2
- Convert O(n2) searches to hashtables
- Option to add "Play FM with AngelLoader" or similar to Explorer context menu HOT 1
- Could you include AngelLoader.ico HOT 1
- Update doc for v1.6
- Truncated Folder Name Upon FM Install HOT 1
- Allow specifying a different name for editor exes HOT 1
- Update doc for 1.6.4
- Access fms if they are on a network shared folder via "\\" HOT 1
- There exist semi-broken zip files that FMSel can handle but .NET's zip reader chokes on HOT 1
- General thorough behavior-identicality test in x64 profile
- Perf comparison of every perf-sensitive task in x86 vs. x64, and write notes HOT 1
- In "Enable/Disable Mods" list, correctly display mod paths which both start with a directory operator and point at a compressed file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angelloader.