Commit Graph

118 Commits

Author SHA1 Message Date
Rika Ichinose
0b97f169b0 Remove conditionals that rely on not defined(FPC_HAS_CPSTRING). 2024-11-04 10:28:33 +00:00
Michaël Van Canneyt
25c75b1784 * Ensure null-terminated strings. Patch by modersohn, fixes issue #40499 2023-11-03 17:01:03 +01:00
Michael VAN CANNEYT
ccfa38c68e * Dotted RTL compiles 2023-07-27 19:04:03 +02:00
Michaël Van Canneyt
bf3ced76b2 * Remove use of internal conversion routines 2023-07-15 18:22:36 +02:00
Michael VAN CANNEYT
6ffa3d4a89 * Char -> AnsiChar 2023-07-14 17:26:09 +02:00
Pierre Muller
a342b74f66 Set iconv_is_in_libc macro for DragonFly OS 2023-05-26 09:39:39 +02:00
Pierre Muller
01ad5f2c28 Set macro iconv_is_in_libc for FreeBSD OS 2023-05-05 14:27:58 +02:00
ondrej
f982317ebd * cwstring: open iconv with the transliterate flag if iconvctl is not available
git-svn-id: trunk@47635 -
2020-11-29 17:09:19 +00:00
ondrej
6854f171d1 * revert r47631: cwstring: open iconv with the transliterate flag instead of setting it later with iconvctl because it may be unavailable
git-svn-id: trunk@47633 -
2020-11-29 14:59:18 +00:00
ondrej
91229dcee9 * cwstring: open iconv with the transliterate flag instead of setting it later with iconvctl because it may be unavailable
git-svn-id: trunk@47631 -
2020-11-29 12:08:55 +00:00
ondrej
a33256c1fb * cwstring: try to load the iconv library with .6 suffix as well
git-svn-id: trunk@47630 -
2020-11-29 10:53:23 +00:00
Károly Balogh
7f0675d937 netbsd: updated to link against the right setlocale function. the renaming from __setlocale_mb_len_max_32 to __setlocale50 occured in NetBSD include/locale.h in rev 1.17, which was in 2010, and shipped in NetBSD 6 in 2012.
git-svn-id: trunk@43118 -
2019-10-04 11:28:10 +00:00
pierre
0e6c072365 define iconv_is_in_libc by default for netbsd OS (can be disabled by adding -dDISABLE_ICONV_LIBC option
git-svn-id: trunk@39801 -
2018-09-24 22:20:30 +00:00
michael
fde42ca8ef * Type helpers, compatible to Delphi XE 8
git-svn-id: trunk@32262 -
2015-11-07 09:40:54 +00:00
Jonas Maebe
4e0d546323 * Use mbrlen instead of mblen under Haiku like on other Unix like platforms.
This fixes the twide3 unit test (patch by Olivier Coursière, mantis #28538)

git-svn-id: trunk@31427 -
2015-08-25 21:26:05 +00:00
Jonas Maebe
7f61cf5519 * Modify CODESET value according to the corresponding declaration in
langinfo.h under Haiku (patch by Olivier Cousière, mantis #28523)

git-svn-id: trunk@31329 -
2015-08-16 13:22:45 +00:00
Jonas Maebe
5a8959381c + Darwin/AArch64 support
git-svn-id: trunk@29934 -
2015-02-23 22:53:50 +00:00
Jonas Maebe
b0c7415f3a * fixed CharLengthPChar() implementation and added comment (from Windows
sysutils unit) about what it does (this routine currently isn't used
    anywhere, so the bugs didn't really have any impact)

git-svn-id: trunk@29378 -
2015-01-03 22:58:10 +00:00
Jonas Maebe
63bd65942b * fall back to UTF-8 for darwin in unixcp.GetSystemCodePage if no LC_*/LANG
environment variables are set
  * if no LC_*/LANG environment variables are set, let cwstring fall back to
    unixcp.GetSystemCodePage
   o this is mainly to avoid problems on OS X, where under certain
     circumstances these variables are not set for GUI programs and
     as a result we set the system code page to ASCII

git-svn-id: trunk@29257 -
2014-12-11 19:11:11 +00:00
marco
2578514853 * first dragonfly patch (existing most). Mantis #27091
git-svn-id: trunk@29213 -
2014-12-07 20:27:02 +00:00
Jonas Maebe
bee20f79f0 * save original widestring manager on entry and restore it on exit, so that
units finalized afterwards won't try to use the finalized cwstring
    manager (mantis #26252)

git-svn-id: trunk@27842 -
2014-06-01 18:30:49 +00:00
marco
0bb6469b80 * remove accidentally inserted BOM, as reported by M. Ring.
git-svn-id: trunk@26358 -
2014-01-02 14:34:28 +00:00
marco
ebe262762a * Clean out of $i textrec and filerec includes that are redundant now that cpstrrtl exposes
those records via system. 

git-svn-id: trunk@26356 -
2014-01-02 13:26:09 +00:00
Jonas Maebe
ecd3cba02b * synchronised with trunk up to r24912
o resolved conflict in updated morphos sysutils unit
   o moved code that had been added to the now deleted  sysunix.inc to the
     unix-specific block of the fpwidestring unit's init code

git-svn-id: branches/cpstrrtl@24913 -
2013-06-17 20:50:02 +00:00
pierre
f4b6625145 + Use __setlocale_mb_len_max_32 for netbsd as suggested by linker warning
git-svn-id: trunk@23696 -
2013-03-05 11:40:24 +00:00
yury
2b2a68446d * Added new unit unixcp. It contains stuff from winiconv.inc - a table to map Windows code page identifiers to locale names on unix. Also GetSystemCodePage function in this unit can be used to detect which code page is used currently.
* Build unixcp for all unix-like systems.
* Use the unixcp unit in cwstring instead of winiconv.inc.
- Deleted winiconv.inc
- Reverted r22410,r22411,r22428. The compiler will use the unixcp unit to get a default code page for ansistrings.

git-svn-id: trunk@23670 -
2013-02-28 18:21:28 +00:00
Jonas Maebe
8bf71af3b1 * fixed compatilation on Haiku Alpha4 (patch by Olivier Coursière,
mantis #23300)

git-svn-id: trunk@22969 -
2012-11-10 20:26:46 +00:00
Jonas Maebe
598d2feeb6 + rtldefs.inc file for every target that contains defines shared by multiple
RTL units. Comes with a FPCRTL_FILESYSTEM_UTF8 define that can be
    activated for targets whose single byte filesystem interface enforces
    UTF-8; included in inc/systemh.inc and unix/cwstring.pp until now
  + DefaultFileSystemCodePage variable that holds the code page used for
    communicating with the OS single byte file system APIs, and for the
    strings returned by those same APIs. Initialized with
   o the result of GetACP in the system unit of Windows platforms, except for
     WinCE which uses UTF-8 since its file system OS API calls already use
     the UTF-16 versions
   o CP_UTF8 on Unix platforms with FPCRTL_FILESYSTEM_UTF8 defined, and with
     DefaultSystemCodePage on other Unix platforms
   o DefaultSystemCodePage on Java/Android JVM targets
  + DefaultRTLFileSystemCodePage variable that holds the code page used to
    encode strings returned by RTL routines that return filenames obtained
    from OS API calls. By default the same as DefaultFileSystemCodePage on
    all platforms. Separate from DefaultFileSystemCodePage for clarity on
    platforms that may use either utf-16 or single byte OS API calls to
    send/receive file names (such as most Windows platforms)
  + new scpFileSystemSingleByte enum that can be passed to
    GetStandardCodePage() to get the default code page for OS single byte file
    system APIs, with implementations for Unix and Windows
  + SetMultiByteFileSystemCodePage() procedure to override the value of
    DefaultFileSystemCodePage

  In principle, in the long run unchanged programs only using generic
  ansistrings and unicodestrings should (mostly) behave the same as in
  FPC 2.6.0 as far as RTL-level file system APIs are concerned if
  they set DefaultFileSystemCodePage and DefaultRTLFileSystemCodePage
  to DefaultSystemCodePage at the start of their execution

git-svn-id: branches/cpstrrtl@22466 -
2012-09-27 07:54:06 +00:00
pierre
7d82ed4459 + Add ACCEPT_646 for systems that return '646' for nl_langinfo(CODESET) call
git-svn-id: trunk@20905 -
2012-04-17 15:28:28 +00:00
Jonas Maebe
f0b7ce8afe * fix building for Haiku/BeOS after r20839 (patch by Olivier Coursière)
git-svn-id: trunk@20878 -
2012-04-14 20:36:02 +00:00
Jonas Maebe
1e9b92ee50 + AIX support for cwstring
o AIX-specific codepage names
   o AIX/ppc32 uses a 16 bit wchar_t
   o special support for handling cp866 on AIX: AIX only supports converting
     cp866 from/to ISO8859-5 -> always use that code page as an intermediate
     one on AIX (it's lossy, but better than completely failing)
  * in case the default system code page cannot be detected, fall back to
    UTF-8

git-svn-id: trunk@20839 -
2012-04-11 18:06:22 +00:00
Jonas Maebe
2c1f98320f * disable implicit exception frames, no exceptions are raised by this unit
git-svn-id: trunk@20838 -
2012-04-11 18:06:18 +00:00
Jonas Maebe
8d8fc0fdee + RTL for AIX
git-svn-id: trunk@20786 -
2012-04-11 17:59:49 +00:00
Jonas Maebe
d3004d2bf6 * use same defaults for iPhoneSimulator as for iOS (UTF-8 etc, newer
iPhoneSimulator platforms no longer inherit the Mac OS X settings)

git-svn-id: trunk@20653 -
2012-03-29 17:13:29 +00:00
pierre
ff5d25174a * Fix wide string shared library loading by adding 'lib' prefix if needed
git-svn-id: trunk@20568 -
2012-03-22 09:02:07 +00:00
pierre
24d100d164 NetBSD CODESET and LC_ALL added
git-svn-id: trunk@20337 -
2012-02-13 16:43:45 +00:00
sergei
e94508d5eb * Improved utf16 to ucs4 conversion routines: removed function call on every character, allocate memory once and made as much as possible code shared between WideString and UnicodeString versions.
git-svn-id: trunk@20269 -
2012-02-06 17:55:06 +00:00
sergei
c862aec17c * cwstring.pp, Wide2AnsiMove: moved SetCodePage to the end, so it comes after the last SetLength. Necessary after r20209, because SetLength has been modified to always set the code page of its argument. Here it sets code page of 'dest' to CP_NONE, because dest is RawByteString.
(Before r20209, SetLength was preserving code page when the string was resized in place and had refcount=1)

git-svn-id: trunk@20214 -
2012-02-01 21:08:13 +00:00
Jonas Maebe
eb680bcc5b * don't try to set the iconv transliterate property in case the iconv
encoder was not successfully initialised

git-svn-id: trunk@19965 -
2012-01-04 16:08:15 +00:00
Jonas Maebe
f287cf3f61 * default to UTF-8 as system code page in case nl_langinfo(CODESET) returns
an empty string

git-svn-id: trunk@19964 -
2012-01-04 16:06:27 +00:00
paul
b7185a554c rtl:
- replace ifndef ver2_4 with ifdef FPC_HAS_CPSTRING for places with TextRec.CodePage access
  - convert codepages for Read and Write text file operations

git-svn-id: trunk@19545 -
2011-10-25 08:40:49 +00:00
paul
e08c68f308 rtl: set codepages for TextRec field when Text file is opened + update this field for standard IO files when cwstring is used
git-svn-id: trunk@19543 -
2011-10-25 06:27:54 +00:00
paul
270fb09e87 rtl: add WideStringManager.GetStandardCodePageProc method to retrieve system ansi and console code pages
git-svn-id: trunk@19539 -
2011-10-25 01:39:11 +00:00
paul
3e29f0b179 rtl: make cwstring.pp dependent of dynlibs, load iconvctl dynamically
git-svn-id: trunk@19538 -
2011-10-25 01:25:23 +00:00
Jonas Maebe
01b980a462 * added "inc" extension to {$i winiconv}
git-svn-id: trunk@19529 -
2011-10-22 08:59:07 +00:00
Jonas Maebe
2b63a7d66f * fixed compilation on darwin/arm after r19522
* replaced defined(arm) with defined(cpuarm) checks (cleaner)

git-svn-id: trunk@19528 -
2011-10-22 08:40:37 +00:00
paul
5d7d143300 rtl: transliterate characters if possible intead of replacing them with "?" chars while converting between codepages
git-svn-id: trunk@19522 -
2011-10-21 03:23:23 +00:00
pierre
dbd3df9ddf + Added OpenBSD CODESET and LC_ALL values
git-svn-id: trunk@19369 -
2011-10-04 22:20:41 +00:00
paul
6384fa2a19 rtl: revert r19330. We probably need to create a separate encoding<->codepage table.
git-svn-id: trunk@19332 -
2011-10-03 10:28:14 +00:00
paul
a0e7196ae9 rtl: move winiconv.inc into general inc directory and rename it to wincodepages.inc, also rename win2iconv, iconv2win to CodePageToCodePageName, CodePageNameToCodePage.
This change is required since CodePage to CodePage name conversions are required in other parts of RTL. Moreover those codepage identifiers are windows codepage identifiers and thus must be compatible with codepage identifiers used by delphi.

git-svn-id: trunk@19330 -
2011-10-03 03:35:45 +00:00